From 9d48baee24acd20d9e3dbb122883a5d17469a1a8 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Wed, 29 Jun 2011 16:52:24 -0400 Subject: [PATCH] More README --- README.org | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 7c419d1..a501504 100644 --- a/README.org +++ b/README.org @@ -46,4 +46,43 @@ mentioned above. * Configuration - TODO + To configure lager's backends, you use an application variable (probably in + your app.config): + +#+BEGIN_EXAMPLE + {lager, + {handlers, [ + {lager_console_backend, [info]}, + {lager_file_backend, [{"error.log", error}, {"console.log", info}]} + ]} + }. +#+END_EXAMPLE + + The available configuration options for each backend are listed in their + module's documentation. + +* Error logger integration + Lager is also supplied with a error_logger handler module that translates + traditional erlang error messages into a friendlier format and sends them into + lager itself to be treated like a regular lager log call. To enable this, set + the lager application variable `error_logger_redirect' to `true'. + +* Runtime loglevel changes + You can change the log level of any lager backend at runtime by doing the + following: + +#+BEGIN_EXAMPLE + lager:set_loglevel(lager_console_backend, debug). +#+END_EXAMPLE + + Or, for the backend with multiple handles (files, mainly): + +#+BEGIN_EXAMPLE + lager:set_loglevel(lager_console_backend, "console.log" debug). +#+END_EXAMPLE + + Lager keeps track of the minium log level being used by any backend and + supresses generation of messages lower than that level. This means that debug + log messages, when no backend is consuming debug messages, are effectively + free. A simple benchmark of doing 1 million debug log messages while the the + minimum threshold was above that takes less than half a second.