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.
25 lines
419 B
Lua
25 lines
419 B
Lua
---
|
|
-- compatiable with lualogging
|
|
--
|
|
local M = {}
|
|
|
|
function M.new(default)
|
|
if not default then
|
|
default = require"log.formatter.format".new()
|
|
end
|
|
|
|
return function(...)
|
|
if type((...)) == 'function' then
|
|
return (...)(select(2, ...))
|
|
end
|
|
|
|
if select('#', ...) < 2 then
|
|
return tostring((...))
|
|
end
|
|
|
|
return default(...)
|
|
end
|
|
end
|
|
|
|
return M
|