From 6b5677b870a4c2a62daf3ef97baae3eec3fd15da Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sat, 9 Nov 2019 13:16:17 +1100 Subject: [PATCH] made dprint go through syslog in all cases --- module/syslog.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/module/syslog.lua b/module/syslog.lua index 0c73715..ecfc323 100644 --- a/module/syslog.lua +++ b/module/syslog.lua @@ -1,5 +1,4 @@ -dprint=dprint or function() end - +do syslog = {} syslog.emergency = 0 syslog.alert = 1 @@ -10,8 +9,15 @@ syslog.notice = 5 syslog.info = 6 syslog.debug = 7 +local rdprint=dprint or function() end setmetatable(syslog,{__call = function(_,msg, level, service) - level, service = level or syslog.info, service or os.taskInfo(os.pid()).name or "unknown" - dprint(string.format("syslog: [%s:%d/%d] %s",service,os.pid(),level,msg)) + level, service = level or syslog.info, service or (os.taskInfo(os.pid()) or {}).name or "unknown" + rdprint(string.format("syslog: [%s:%d/%d] %s",service,os.pid(),level,msg)) computer.pushSignal("syslog",msg, level, service) end}) +function dprint(...) + for k,v in pairs({...}) do + syslog(v,syslog.debug) + end +end +end