For logging debug information to files.
local Logger = require('stdlib/log/logger')
-- or to create a logger directly:
local LOGGER = require('stdlib/log/logger').new(...)
-- and to use the same LOGGER in multiple require files make it global by removing 'local'.
log (msg) | Logs a message. |
new (mod_name[, log_name='main'][, debug_mode=false][, options={...}]) | Creates a new logger object. |
write () | Writes out all buffered messages immediately. |
options | Used in the new function for logging game ticks, specifying logfile extension, or forcing the logs to append to the end of the logfile. |
Logs a message.
Parameters:
Creates a new logger object.
In debug mode, the logger writes to file immediately, otherwise the logger buffers the lines.
The logger flushes the logged messages every 60 seconds since the last message.
A table of options may be specified when creating a logger.
Parameters:LOGGER = Logger.new('cool_mod_name')
LOGGER.log("this msg will be logged!")
LOGGER = Logger.new('cool_mod_name', 'test', true)
LOGGER.log("this msg will be logged and written immediately in test.log!")
LOGGER = Logger.new('cool_mod_name', 'test', true, { file_extension = data })
LOGGER.log("this msg will be logged and written immediately in test.data!")
Writes out all buffered messages immediately.
Returns:
Used in the new function for logging game ticks, specifying logfile extension, or forcing the logs to append to the end of the logfile.
Fields: