定製lager的輸出

lager的輸出能夠定製,這裏是個人定製方案。app

在lager/ebin/lager.app裏面的env字段裏添加:code

{env,[...
                {log_root, "log"},
                {handlers, [
                        {lager_console_backend, error},
                        {lager_file_backend, [{file, "error.log"}, {level, error},{formatter, lager_default_formatter}, {formatter_config, ["=ERROR REPORT==== ", date, " ", time, " ===\n", sev, "(", pid, ":", module, ":", line, ") ", message, "\n\n"]}, {size, 10485760}, {date, "$D0"}, {count, 5}]},
                        {lager_file_backend, [{file, "console.log"}, {level, info}]}
                ]},
                ...
                ]}.

輸出的結果是這樣子的:orm

=ERROR REPORT==== 2016-03-17 15:47:22.915 ===
E(<0.85.0>:log_module:36) I:1
相關文章
相關標籤/搜索