ソースを参照

Update README about traces from configuration

pull/336/head
Mark Allen 9年前
コミット
099a35765c
1個のファイルの変更29行の追加0行の削除
  1. +29
    -0
      README.md

+ 29
- 0
README.md ファイルの表示

@ -568,6 +568,35 @@ The former can be ameliorated by opening multiple traces; the latter
can be fixed by rearchitecting lager's file backend, but this has not can be fixed by rearchitecting lager's file backend, but this has not
been tackled. been tackled.
### Traces from configuration
Lager supports starting traces from its configuration file. The keyword
to define them is `traces`, followed by a proplist of tuples that define
a backend handler and zero or more filters in a required list,
followed by an optional message severity level.
An example looks like this:
```erlang
{lager, [
{handlers, [...]},
{traces, [
%% handler, filter, message level (defaults to debug if not given)
{lager_console_backend, [{module, foo}], info },
{{lager_file_backend, "trace.log"}, [{request, '>', 120}], error},
{{lager_file_backend, "event.log"}, [{module, bar}] } %% implied debug level here
]}
]}.
```
In this example, we have three traces. One using the console backend, and two
using the file backend. If the message severity level is left out, it defaults
to `debug` as in the last file backend example.
The `traces` keyword works on alternative sinks too but the same limitations
and caveats noted above apply.
Setting the truncation limit at compile-time Setting the truncation limit at compile-time
-------------------------------------------- --------------------------------------------
Lager defaults to truncating messages at 4096 bytes, you can alter this by Lager defaults to truncating messages at 4096 bytes, you can alter this by

読み込み中…
キャンセル
保存