LuaLogging
A simple API to use logging features in Lua. Portuguese version.

Email appender

This appender can be used to send log requests through email. One email message is sent for each log request.

function logging.email {
    from = string,
    rcpt = string or string-table,
    [user = string,]
    [password = string,]
    [server = string,]
    [port = number,]
    [domain = string,]
    [headers = table,]
    [logPattern = string,]
}
  • from:
    The sender of the email message.
  • rcpt:
    The recipient of the email message. A string or a numerically indexed Lua table with strings.
  • user:
    User for authentication.
  • password:
    Password for authentication.
  • server:
    Server to connect to. Default is "localhost".
  • port:
    Port to connect to. Default is 25.
  • domain:
    Domain name used to greet the server. Defaults to the local machine host name.
  • headers.to:
    The recipient of the message, as an extended description.
  • headers.from:
    The sender of the message, as an extended description.
  • headers.subject:
    The subject of the message sent. This can contain patterns like the logPattern parameter.
  • logPattern:
    A pattern can be specified to control how the message is written.
    The default value is "%date %level %message\n".

Example

require"logging.email"

local logger = logging.email {
  rcpt = "mail@host.com",
  from = "mail@host.com",
  headers = { 
    subject = "[%level] logging.email test", 
  },
}

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

XHTML 1.0 válido!