Browse Source

Document and test the UTC time feature

pull/405/head
Bastien Chamagne 8 years ago
parent
commit
b92ea70331
2 changed files with 29 additions and 0 deletions
  1. +10
    -0
      README.md
  2. +19
    -0
      test/lager_test_backend.erl

+ 10
- 0
README.md View File

@ -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

+ 19
- 0
test/lager_test_backend.erl View File

@ -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
}
]
}.

Loading…
Cancel
Save