LuaLogging: A simple API to use logging features in Lua

LuaLogging
A simple API to use logging features in Lua.

## Console appender

Console is the simplest appender. It just writes the log messages to `io.stdout` or `io.stderr`.

    function logging.console {
        [destination = "stdout"|"stderr",]

        [logPattern = string,]
        [logPatterns = {
          [logging.DEBUG = string,]
          [logging.INFO  = string,]
          [logging.WARN  = string,]
          [logging.ERROR = string,]
          [logging.FATAL = string,]
        },]
        [timestampPattern = string,]
        [logLevel = log-level-constant,]
    }

- `logPatterns`:
  A table with logPattern strings indexed by the log-levels. A logPattern specifies how the message is written.
  If this parameter is omitted, a patterns table will be created with the parameter `logPattern` as the default value for each log-level. If `logPattern` also is omitted then each level will fall back to the current default setting, see `logging.defaultLogPatterns`.
- `logPattern`:
  This value will be used as the default value for each log-level that was omitted in `logPatterns`.
- `timestampPattern`:
  This is an optional parameter that can be used to specify a date/time formatting in the log message. See `logging.date` for the format. The default is taken from `logging.defaultTimestampPattern()`.
- `destination`:
  The destination stream, optional. The value can be either `"stdout"`, or `"stderr"`. The default is `stdout`.
- `logLevel`:
  The initial log-level to set for the created logger.

## Examples

    local ansicolors = require("ansicolors") -- https://github.com/kikito/ansicolors.lua
    local ll = require("logging")
    require "logging.console"

    -- set up the default logger to stderr + colorization
    ll.defaultLogger(ll.console {
      logLevel = ll.DEBUG,
      destination = "stderr",
      timestampPattern = "%y-%m-%d %H:%M:%S",
      logPatterns = {
        [ll.DEBUG] = ansicolors("%date%{cyan} %level %message %{reset}(%source)\n"),
        [ll.INFO] = ansicolors("%date %level %message\n"),
        [ll.WARN] = ansicolors("%date%{yellow} %level %message\n"),
        [ll.ERROR] = ansicolors("%date%{red bright} %level %message %{reset}(%source)\n"),
        [ll.FATAL] = ansicolors("%date%{magenta bright} %level %message %{reset}(%source)\n"),
      }
    })

    local log = ll.defaultLogger()

    log:info("logging.console test")
    log:debug("debugging...")
    log:error("error!")