fix logging to systemd and switch to stderr for warning and fatal

此提交包含在:
erpalma
2019-01-24 08:52:56 +01:00
父節點 7ac672dd7d
當前提交 56a91aaf6f
共有 2 個檔案被更改,包括 4 行新增2 行删除

查看文件

@@ -88,12 +88,12 @@ LIM = bcolors.YELLOW + bcolors.BOLD + 'LIM' + bcolors.RESET
def fatal(msg, code=1): def fatal(msg, code=1):
print('[E] {:s}'.format(msg)) print('[E] {:s}'.format(msg), file=sys.stderr)
sys.exit(code) sys.exit(code)
def warning(msg): def warning(msg):
print('[W] {:s}'.format(msg)) print('[W] {:s}'.format(msg), file=sys.stderr)
def writemsr(msr, val): def writemsr(msr, val):

查看文件

@@ -4,6 +4,8 @@ Description=Stop Intel throttling
[Service] [Service]
Type=simple Type=simple
ExecStart=/opt/lenovo_fix/venv/bin/python3 /opt/lenovo_fix/lenovo_fix.py ExecStart=/opt/lenovo_fix/venv/bin/python3 /opt/lenovo_fix/lenovo_fix.py
# Setting PYTHONUNBUFFERED is necessary to see the output of this service in the journal
Environment=PYTHONUNBUFFERED=1
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog