Giter Club home page Giter Club logo

logger_journald_backend's Introduction

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:

config :logger,
  backends: [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:

config :logger,
  backends: [Logger.Backend.Journald]

config :logger, :logger_journald_backend,
  level: :debug,
  format: "[$level] $message\n",
  metadata: [:city]

and use it as:

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

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

$ journalctl | sed '$!d'
Aug 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:

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

Dependency

logger_journald_backend uses ejournald.

logger_journald_backend's People

Contributors

0xax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

addico cnsa dtwood

logger_journald_backend's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.