Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 74ea2bc

Browse files
Add python sys log address for mac on weave-register-service.py
-- In mac os, SysLoggerHandler should send to /var/run/syslog when using standard python logging library.
1 parent 5c52bb5 commit 74ea2bc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/test-apps/happy/bin/weave-register-service.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33

44
#
5-
# Copyright (c) 2015-2017 Nest Labs, Inc.
5+
# Copyright (c) 2015-2018 Nest Labs, Inc.
6+
# Copyright (c) 2019 Google, LLC.
67
# All rights reserved.
78
#
89
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,7 +41,13 @@
4041
'%(funcName)s] : %(message)s'
4142
log_line_time_format = '%m/%d/%Y %I:%M:%S %p'
4243
formatter = logging.Formatter(log_line_format, datefmt=log_line_time_format)
43-
syslog_handler = logging.handlers.SysLogHandler(address="/dev/log")
44+
45+
if sys.platform == "darwin":
46+
address = "/var/run/syslog"
47+
else:
48+
address = "/dev/log"
49+
50+
syslog_handler = logging.handlers.SysLogHandler(address=address)
4451
syslog_handler.setFormatter(formatter)
4552
logger.addHandler(syslog_handler)
4653
stream_handler = logging.StreamHandler()

0 commit comments

Comments
 (0)