diff --git a/README.md b/README.md index ffb2c98..1de4e6f 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,16 @@ Examples: [{server,{pid, ["(", pid, ")"], ["(Unknown Server)"]}}] -> user provided server metadata, otherwise "()", otherwise "(Unknown Server)" ``` +Universal time +----------------- +Lager reads the `sasl` application's configuration, if `utc_log` is set to `true`, the times will be displayed in UTC format. + +Example: + +``` +application:set_env(sasl, utc_log, true). +``` + Error logger integration ------------------------ Lager is also supplied with a `error_logger` handler module that translates diff --git a/test/lager_test_backend.erl b/test/lager_test_backend.erl index 5d1f68e..999ae05 100644 --- a/test/lager_test_backend.erl +++ b/test/lager_test_backend.erl @@ -696,6 +696,25 @@ lager_test_() -> ?assertError(badarg, lager:md("zookeeper zephyr")), ok end + }, + {"dates should be local by default", + fun() -> + lager:warning("so long, and thanks for all the fish"), + ?assertEqual(1, count()), + {_Level, {_Date, Time}, _Message, _Metadata} = pop(), + ?assertEqual(nomatch, binary:match(iolist_to_binary(Time), <<"UTC">>)), + ok + end + }, + {"dates should be UTC if SASL is configured as UTC", + fun() -> + application:set_env(sasl, utc_log, true), + lager:warning("so long, and thanks for all the fish"), + ?assertEqual(1, count()), + {_Level, {_Date, Time}, _Message, _Metadata} = pop(), + ?assertNotEqual(nomatch, binary:match(iolist_to_binary(Time), <<"UTC">>)), + ok + end } ] }.