Windows NT Event Log backend for lager
C Erlang C++
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
c_src
src
.gitignore
LICENSE
README.md
rebar.config

README.md

Overview

This is an NT Event Log backend for Lager. It allows you to send messages out of lager and into the local NT Event Log.

Configuration

Configure a Lager handler like the following:

{lager_nt_eventlog_backend, [Source, Level]}

Source is the string to tag all messages with in the Event Log, usually the application's name.

Level is the lager level at which the backend accepts messages (eg. using info would send all messages at info level or above into the Event Log).

An example might look something like this:

{lager_nt_eventlog_backend, ["product", info]}

Custom Formatting

A custom formatter can be supplied via the configuration:

{lager_nt_eventlog_backend, [Source, Level, {Formatter, FormatConfig}]}

Formatter is an atom of a module that implements the format(lager_msg:lager_msg(),list()) -> any() callback.

FormatConfig is an iolist of instructions that the Formatter uses to construct the message. Refer to Lager's documentation for specific options.

When the formatter tuple is not specified, the module lager_default_formatter and the following format config will be used by default to construct log messages similar to Lager 1.0

[
  {pid, ""},
  {module, [
    {pid, ["@"], ""},
    module,
    {function, [":", function], ""},
    {line, [":",line], ""}], ""},
  " ",
  message
]

Refer to Lager's documentation for futher information on configuring handlers.

THANKS

This code would not have been possible without the prior art of the following open-source projects: