LuaLogging
A simple API to use logging features in Lua.

Socket appender

This appender can be used to send log requests through a socket. Socket appender relies on LuaSocket to do its job.
Upon each log request a connection is opened, the message is sent and the connection is closed.
function logging.socket {
    hostname = string,
    port = number,
    [logPattern = string,]
    [timestampPattern = string],
}
  • hostname:
    Hostname can be an IP address or a host name of the server where the log message will be sent.
  • port:
    The port must be an integer number in the range [1..64K).
  • logPattern:
    A pattern can be specified to control how the message is written.
    The default value is "%date %level %message\n".
  • timestampPattern:
    This is an optional parameter that can be used to specify a date pattern that will be passed to the os.date function to create the timestamp for the log message.

Example

require"logging.socket"

local logger = logging.socket {
  hostname = "localhost",
  port = 5000,
}

logger:info("logging.socket test")
logger:debug("debugging...")
logger:error("error!")

 

 

 

 

XHTML 1.0 válido!