1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-12-24 19:59:20 -05:00

made dprint go through syslog in all cases

This commit is contained in:
XeonSquared 2019-11-09 13:16:17 +11:00
parent 5f8e4efe33
commit 6b5677b870

View File

@ -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