Skip to content

Commit 02eb124

Browse files
committed
introduced macos support, untested
1 parent 635e625 commit 02eb124

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/loggedfs/log.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,21 @@
3232
import logging
3333
import logging.handlers
3434
import os
35+
import platform
3536

3637
from .timing import time
3738

3839

40+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41+
# CONST
42+
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
43+
44+
SYSLOG_ADDRESS = {
45+
'Linux': '/dev/log',
46+
'Darwin': '/var/run/syslog'
47+
}
48+
49+
3950
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4051
# LOGGING: Support nano-second timestamps
4152
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -88,7 +99,10 @@ def get_logger(name, log_enabled, log_file, log_syslog):
8899
logger.addHandler(ch)
89100

90101
if bool(log_syslog):
91-
sl = logging.handlers.SysLogHandler(address = '/dev/log') # TODO Linux only
102+
try:
103+
sl = logging.handlers.SysLogHandler(address = SYSLOG_ADDRESS[platform.system()])
104+
except KeyError:
105+
raise NotImplementedError('unsupported operating system')
92106
sl.setLevel(logging.DEBUG)
93107
sl.setFormatter(log_formater_short)
94108
logger.addHandler(sl)

0 commit comments

Comments
 (0)