Name: exlager
Owner: xerions
Description: Elixir binding for lager
Forked from: khia/exlager
Created: 2015-06-03 09:20:39.0
Updated: 2017-01-09 13:12:51.0
Pushed: 2017-10-11 08:53:06.0
Homepage: null
Size: 50
Language: Elixir
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This package implements a simple wrapper over https://github.com/basho/lager.
It embeds logging calls to ExLager into a module if currently configured logging level is less or equal than severity of a call. Therefore it doesn't have any negative impact on performance of a production system when you configure error level even if you have tons of debug messages.
Information about location of a call (module, function, line, pid) is properly passed to lager for your convinience so you can easily find the source of a message. In this aspect using ExLager is equal to using parse transform shipped with basho lager.
Since ExLager depends on macro implemented in Lager module you have to require it. Then you call one of logging methods on Lager module. There are seven logging methods in order of severity:
odule Test do
quire Lager
f debug do
Lager.debug "Hi debug"
d
f info do
Lager.info "Hi error"
d
f notice do
Lager.notice "Hi notice"
d
f warning do
Lager.warning "Hi warning"
d
f error do
Lager.error "Hi error"
d
f critical do
Lager.critical "Hi critical"
d
f alert do
Lager.alert "Hi alert"
d
f emergency do
Lager.emergency "Hi emergency"
d
f test do
debug
info
notice
warning
error
critical
alert
emergency
d
ication.start :exlager
.test
It is possible to configure truncation size and compile time log level. Beign a simple wrapper ExLager doesn't attempt to configure underlying Lager. You would need to configure it yourself see to ensure that:
Configuration of ExLager can be done by calling helper functions of Lager from your build system as follows:
1)> Lager.compile_log_level(:info)
2)> Lager.compile_truncation_size(512)
If you cannot call those function you can set compiler options:
3)> Code.compiler_options exlager_level: :debug
4)> Code.compiler_options exlager_truncation_size: 512
If you are mix user you could specify level and truncation_size in config/config.#{Mix.env}.exs as follows:
use Mix.Config
config :exlager,
level: :debug,
truncation_size: 8096