/ex_winlog

Elixir Logger Backend that enables applications to log to the Windows Event Log

Primary LanguageElixirMIT LicenseMIT

Build Status Hex pm Hex pm

ex_winlog - Log to Windows Event Log with Elixir

This library enables Elixir applications to log to the Windows Event Log, using the Logger interface. It makes use of Rust's winlog crate. Docs can be found at https://hexdocs.pm/ex_winlog.

Installation

Since this library uses Rustler, you must have Rust installed on the machine when compiling.

def deps do
  [
    {:ex_winlog, "~> 0.1"}
  ]
end

Usage

Since ExWinlog is a Logger backend, you can add it to your list of backends in your config.exs file like this:

config :logger,
  backends: [:console, {ExWinlog, "My Event Source Name"}]

Registering Event Sources

The ExWinlog backend requires that the event source, "My Event Source Name" in the example, is registered with Windows Event Viewer. Use ExWinlog.register/1 and ExWinlog.deregister/1, while running the application as an administrator, to manage the sources. This should typically be done once when installing or uninstalling the application.