/usr/share/doc/lua-systemd-dev/examples/logger.lua is in lua-systemd-dev 0~git20160517-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | local journal = require "systemd.journal"
function log(severity, msg, level)
local info = debug.getinfo((level or 1)+1, "nlS")
if info.currentline == -1 then
info.currentline = nil
end
return assert(journal.sendt{
CODE_FILE = info.short_src;
CODE_FUNC = info.name;
CODE_LINE = info.currentline;
PRIORITY = journal.LOG[severity:upper()] or 5;
MESSAGE = msg;
})
end
|