Module Logger
Allows user-configurable logging.
The messages can be logged using Spring.Echo
, logged into a common file, logged into separate files or ignored altogether.
Functions
Logger.assert (logGroup, shouldLog, ...) | Logs the error message if allowed under the supplied log-group. |
Logger.disable (logGroup) | Disables the logging of the specified log-group. |
Logger.error (logGroup, ...) | Logs the error message under the supplied log-group. |
Logger.log (logGroup, ...) | Logs the message under the supplied log-group. |
Logger.registerHandler (handler, ...) | Registers a handler function that is launched whenever there is a new log message (of any kind). |
Logger.warn (logGroup, ...) | Logs the warning message under the supplied log-group. |
Fields
Logger.settings | Stores the settings with regard to how to log different log-groups. |
Functions
- Logger.assert (logGroup, shouldLog, ...)
-
Logs the error message if allowed under the supplied log-group. Otherwise returns arguments.
Equivalent to regular assert.
Parameters:
- logGroup specifies the log-group under which the message belongs
- shouldLog specifies whether an error message should be logged
- ... the rest of the arguments forms the error message after their conversion to string
- Logger.disable (logGroup)
-
Disables the logging of the specified log-group.
Parameters:
- logGroup
- Logger.error (logGroup, ...)
-
Logs the error message under the supplied log-group.
Parameters:
- logGroup specifies the log-group under which the message belongs
- ... the rest of the arguments forms the error message after their conversion to string
- Logger.log (logGroup, ...)
-
Logs the message under the supplied log-group.
Parameters:
- logGroup specifies the log-group under which the message belongs
- ... the rest of the arguments forms the message after their conversion to string
- Logger.registerHandler (handler, ...)
-
Registers a handler function that is launched whenever there is a new log message (of any kind).
Additonal parameters specify whether the handler should be used for all log-groups (if there are none) or just some (the ones specified by the parameters).
A non-nil return value of the handler is used as the return value of log, warn or error functions.
Remarks:
Parameters:
- handler
- ... list of log-group names that the handler should be used for, or no arguments if it should be applied to all
- Logger.warn (logGroup, ...)
-
Logs the warning message under the supplied log-group.
Parameters:
- logGroup specifies the log-group under which the message belongs
- ... the rest of the arguments forms the warning message after their conversion to string
Fields
- Logger.settings
-
Stores the settings with regard to how to log different log-groups.
Instance of FileTable linked with the file
LuaUI/Config/debug_utils_logger.lua
.