1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-22 12:04: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 = {}
syslog.emergency = 0 syslog.emergency = 0
syslog.alert = 1 syslog.alert = 1
@ -10,8 +9,15 @@ syslog.notice = 5
syslog.info = 6 syslog.info = 6
syslog.debug = 7 syslog.debug = 7
local rdprint=dprint or function() end
setmetatable(syslog,{__call = function(_,msg, level, service) setmetatable(syslog,{__call = function(_,msg, level, service)
level, service = level or syslog.info, service or os.taskInfo(os.pid()).name or "unknown" level, service = level or syslog.info, service or (os.taskInfo(os.pid()) or {}).name or "unknown"
dprint(string.format("syslog: [%s:%d/%d] %s",service,os.pid(),level,msg)) rdprint(string.format("syslog: [%s:%d/%d] %s",service,os.pid(),level,msg))
computer.pushSignal("syslog",msg, level, service) computer.pushSignal("syslog",msg, level, service)
end}) end})
function dprint(...)
for k,v in pairs({...}) do
syslog(v,syslog.debug)
end
end
end