simplify the logging system implementation

This commit is contained in:
uleelx 2015-04-07 19:25:12 +08:00
parent a9e7905ca1
commit 4a5bb816e4

View File

@ -93,24 +93,12 @@ local function common_log(logger, level, message)
end end
end end
flatdb.hack.debug = function(logger, msg) local levels = {"debug", "info", "warn", "error", "fatal"}
common_log(logger, "debug", msg)
end
flatdb.hack.info = function(logger, msg) for _, level in ipairs(levels) do
common_log(logger, "info", msg) flatdb.hack[level] = function(logger, msg)
end common_log(logger, level, msg)
end
flatdb.hack.warn = function(logger, msg)
common_log(logger, "warn", msg)
end
flatdb.hack.error = function(logger, msg)
common_log(logger, "error", msg)
end
flatdb.hack.fatal = function(logger, msg)
common_log(logger, "fatal", msg)
end end
flatdb.hack.find = function(logger, level, date) flatdb.hack.find = function(logger, level, date)