Skip to content

Commit 85f185f

Browse files
author
Mark Allen
authored
Merge pull request erlang-lager#489 from erlang-lager/gh363
Document error_logger_whitelist and other updates
2 parents c215a29 + 8c08e9d commit 85f185f

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

‎.travis.yml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
sudo: false
22
language: erlang
33
otp_release:
4-
- 21.0
5-
- 20.0
4+
- 21.1
5+
- 20.3
66
- 19.3
7-
- 18.3
8-
7+

‎README.md‎

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ We review PRs and issues at least once a month as described below.
5454
OTP Support Policy
5555
------------------
5656
The lager maintainers intend to support the past three OTP releases from
57-
current on the main 3.x branch of the project. As of July 2017 that includes
58-
20, 19, and 18.
57+
current on the main 3.x branch of the project. As of December 2018 that includes
58+
21, 20, 19.
5959

6060
Lager may or may not run on older OTP releases but it will only be guaranteed
6161
tested on the previous three OTP releases. If you need a version of lager
@@ -294,6 +294,14 @@ the lager application variable `error_logger_redirect` to `false`.
294294
You can also disable reformatting for OTP and Cowboy messages by setting variable
295295
`error_logger_format_raw` to `true`.
296296

297+
If you installed your own handler(s) into `error_logger`, you can tell
298+
lager to leave it alone by using the `error_logger_whitelist` environment
299+
variable with a list of handlers to allow.
300+
301+
```
302+
{error_logger_whitelist, [my_handler]}
303+
```
304+
297305
The `error_logger` handler will also log more complete error messages (protected
298306
with use of `trunc_io`) to a "crash log" which can be referred to for further
299307
information. The location of the crash log can be specified by the `crash_log`
@@ -593,6 +601,7 @@ on your favorite search engine is a good starting point.
593601

594602
Exception Pretty Printing
595603
----------------------
604+
Up to OTP 20:
596605

597606
```erlang
598607
try
@@ -605,6 +614,19 @@ catch
605614
end.
606615
```
607616

617+
On OTP 21+:
618+
619+
```erlang
620+
try
621+
foo()
622+
catch
623+
Class:Reason:Stacktrace ->
624+
lager:error(
625+
"~nStacktrace:~s",
626+
[lager:pr_stacktrace(Stacktrace), {Class, Reason}])
627+
end.
628+
```
629+
608630
Record Pretty Printing
609631
----------------------
610632
Lager's parse transform will keep track of any record definitions it encounters
@@ -935,8 +957,6 @@ will be impacted by what the functions you call do and how much latency they
935957
may introduce. This impact will even greater with `on_log` since the calls
936958
are injected at the point a message is logged.
937959

938-
939-
940960
Setting the truncation limit at compile-time
941961
--------------------------------------------
942962
Lager defaults to truncating messages at 4096 bytes, you can alter this by
@@ -1121,6 +1141,7 @@ Example Usage:
11211141
3.x Changelog
11221142
-------------
11231143
3.6.7 - 14 October 2018
1144+
11241145
* Bugfix: fix tracing to work with OTP21 #480
11251146
11261147
3.6.6 - 24 September 2018

0 commit comments

Comments
 (0)