You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
locallog=require("log")
localinfo, err=log.new("/path/to/file.log")
info:close() -- don't forgetinfo:set_output("/path/to/file2.log") -- write to new fileinfo:close()
-- prefixlocalinfo, err=log.new("/path/to/file.log", "[INFO] ")
info:print("ok")
info:close() -- don't forget-- flagslocallogger_flags= {
date=true,
time=true,
microseconds=true,
utc=true,
longfile=true,
}
localinfo, err=log.new("/path/to/file.log", "[INFO] ", logger_flags)
info:print("ok")
info:close() -- don't forget-- to stdout/stderrlocalinfo, err=log.new("/path/to/file.log")
info:close() -- don't forgetinfo:set_output("STDOUT") -- to STDOUTinfo:set_output("-") -- to STDOUTinfo:set_output("STDERR") -- to STDERR
loglevel - usage similar to slf4j
locallog=require'loglevel'log.set_default_output('some-file-on-disk') -- defaults to "STDOUT"-- Logs go to /dev/nulllog.DEBUG:print('foobar')
log.DEBUG:printf('foo bar %s', 'baz')
-- Logs go to some-file-on-disk (the default_output setting)log.set_level('DEBUG') -- defaults to "INFO"log.DEBUG:print('foobar')
log.DEBUG:printf('foo bar %s', 'baz')
-- Other loggerslog.DEBUG:print('debug')
log.INFO:print('info')
log.WARN:print('warn')
log.ERROR:print('error')
-- Log levelslog.set_level('DEBUG')
log.set_level('INFO')
log.set_level('WARN')
log.set_level('ERROR')