LuaLogging logo
LuaLogging Reference Manual
A simple API to use logging features in Lua

home · logger · example · related docs


Introduction

LuaLogging is a simple API to use logging features in Lua. Its design is based on log4j.

LuaLogging defines one single global variable, a table called logging which holds the function that creates new loggers.

Logger objects

A logger object offers methods that writes log messages. To create a logger you simply call the function:

Methods

Levels

Example

Below is a small sample code displaying the basic use of the library.
require "logging"

local logger = logging.new("/tmp/test.log")
logger:setLevel (logging.WARN)

logger:log(logging.INFO, "sending email")

logger:info("trying to contact server")
logger:warn("server did not responded yet")
logger:error("server unreachable")

Upon execution the file "/tmp/test.log" contains the following lines.
Notice that the INFO log requests are not handled because the minimum level is set to WARN.
06/17/04 16:21:15 WARN server did not responded yet
06/17/04 16:21:20 ERROR server unreachable

Appenders

Not implemented (yet)

Related documentation

Here is a list of related documentation:

home · logger · example · related docs


$Id: manual.html,v 1.1 2004/07/02 20:26:49 tuler Exp $