For logging debug information to files.
local Logger = require('__stdlib__/stdlib/log/logger')
-- or to create a logger directly:
local LOGGER = require('__stdlib__/stdlib/log/logger').new(...)
Log.log(msg) | Logs a message. |
Log.write() | Writes out all buffered messages immediately. |
get(...) | Get a saved log or create a new one if there is no saved log. |
new(mod_name[, log_name='main'][, debug_mode=false][, options={...}]) | Creates a new logger object. |
Log.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:
Writes out all buffered messages immediately.
Returns:
Get a saved log or create a new one if there is no saved log.
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!")
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: