You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
395 B
Lua
19 lines
395 B
Lua
local string = require "string"
|
|
local Log = require "log"
|
|
|
|
local sformat = string.format
|
|
local function date_fmt(now)
|
|
local Y, M, D = now:getdate()
|
|
return sformat("%.4d-%.2d-%.2d %.2d:%.2d:%.2d", Y, M, D, now:gettime())
|
|
end
|
|
|
|
local M = {}
|
|
|
|
function M.new()
|
|
return function(msg, lvl, now)
|
|
return date_fmt(now) .. ' [' .. Log.LVL_NAMES[lvl] .. '] ' .. msg
|
|
end
|
|
end
|
|
|
|
return M
|