xerions/logger_journald_backend

Name: logger_journald_backend

Owner: xerions

Description: null

Created: 2015-08-21 16:49:02.0

Updated: 2018-05-15 13:19:06.0

Pushed: 2015-08-22 06:48:03.0

Homepage: null

Size: 136

Language: Elixir

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

LoggerJournaldBackend

This is a backend for elixir Logger.

It will send logs out of lager to systemd journald.

Configuration

the Logger.Backend.Journald is a custom backend for the elixir :logger application. To configure lager_journald_backend just add Logger.Backend.Journald the to your configuration like this:

ig :logger,
ckends: [Logger.Backend.Journald]

Without any other configuration, the Logger.Backend.Journald will use info as default log level and "[$level] $message\n" as format for the log messages.

To provide own configuration add backends' configuration to configuration file:

ig :logger,
ckends: [Logger.Backend.Journald]

ig :logger, :logger_journald_backend,
vel: :debug,
rmat: "[$level] $message\n",
tadata: [:city]

and use it as:

er.error "TestLogMessage_Error", [city: "Berlin"]

And then simply check your journal for the corresponding message with the:

urnalctl | sed '$!d'
20 17:55:37 localhost beam.smp[24082]: [error] TestLogMessage_Error
Runtime configuration

Logger provides two functions: add_backend/2 and configure_backend/2 to add backend and configure backend in runtime.

Usage:

er.add_backend(Logger.Backend.Journald, [])
er.configure(Logger.Backend.Journald, [level: :error, format: "$time $message"])
Dependency

logger_journald_backend uses ejournald.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.