Module log

System logging library

Usage:

    local log = require("log")("My Library")
    log.debug("This is worthless to read except when debugging")
    log.info("This is some general information")
    log.warn("This should be noticed")
    log.error("Critical situation!")
    

Functions

fileLogger (path) Returns a logger that logs to the file specified by path
logger.log (msg, level) Log a message with the given level, instead of doing that, specialized methods (logger.debug, logger.info, ...) should be privileged
logger.debug (msg) Log a message with a debug level
logger.info (msg) Log a message with an information level
logger.warn (msg) Log a message with a warning level
logger.error (msg) Log a message with a error level

Tables

logHandlers List of loghandlers

Fields

DEBUG_LEVEL Debug level
INFO_LEVEL Info level
WARN_LEVEL Warning level
ERROR_LEVEL Error level


Functions

fileLogger (path)
Returns a logger that logs to the file specified by path

Parameters:

  • path string The path of the file to write to

Returns:

    loghandler
logger.log (msg, level)
Log a message with the given level, instead of doing that, specialized methods (logger.debug, logger.info, ...) should be privileged

Parameters:

  • msg string The message to log
  • level int The level of the message

Usage:

    local log = require("log")
    local logger = log("My Library")
    logger.log("Hello", log.INFO_LEVEL)
logger.debug (msg)
Log a message with a debug level

Parameters:

  • msg string The message to log
logger.info (msg)
Log a message with an information level

Parameters:

  • msg string The message to log
logger.warn (msg)
Log a message with a warning level

Parameters:

  • msg string The message to log
logger.error (msg)
Log a message with a error level

Parameters:

  • msg string The message to log

Tables

logHandlers
List of loghandlers

Fields

DEBUG_LEVEL
Debug level
INFO_LEVEL
Info level
WARN_LEVEL
Warning level
ERROR_LEVEL
Error level
generated by LDoc 1.4.6 Last updated 2021-12-27 19:58:59