forked from izaya/OC-PsychOS2
made dprint go through syslog in all cases
This commit is contained in:
parent
5f8e4efe33
commit
6b5677b870
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user