Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
forks
lager
Commits
83c2a412
Commit
83c2a412
authored
13 years ago
by
Scott Lystig Fritchie
Browse files
Options
Download
Email Patches
Plain Diff
Mash in the remainder of adt-error-format-protection branch
parent
cf51ba06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/error_logger_lager_h.erl
+3
-3
src/error_logger_lager_h.erl
src/lager_crash_log.erl
+1
-1
src/lager_crash_log.erl
test/lager_test_backend.erl
+6
-0
test/lager_test_backend.erl
with
10 additions
and
4 deletions
+10
-4
src/error_logger_lager_h.erl
View file @
83c2a412
...
...
@@ -80,7 +80,7 @@ handle_event(Event, State) ->
[
ID
,
Name
,
format_reason
(
Reason
)]);
_
->
?
CRASH_LOG
(
Event
),
?
LOG
(
error
,
Pid
,
lager
_trunc_io
:
format
(
Fmt
,
Args
,
4096
))
?
LOG
(
error
,
Pid
,
lager
:
safe_
format
(
Fmt
,
Args
,
4096
))
end
;
{
error_report
,
_
GL
,
{
Pid
,
std_error
,
D
}}
->
?
CRASH_LOG
(
Event
),
...
...
@@ -100,11 +100,11 @@ handle_event(Event, State) ->
?
CRASH_LOG
(
Event
),
?
LOG
(
error
,
Pid
,
[
"CRASH REPORT "
,
format_crash_report
(
Self
,
Neighbours
)]);
{
warning_msg
,
_
GL
,
{
Pid
,
Fmt
,
Args
}}
->
?
LOG
(
warning
,
Pid
,
lager
_trunc_io
:
format
(
Fmt
,
Args
,
4096
));
?
LOG
(
warning
,
Pid
,
lager
:
safe_
format
(
Fmt
,
Args
,
4096
));
{
warning_report
,
_
GL
,
{
Pid
,
std_warning
,
Report
}}
->
?
LOG
(
warning
,
Pid
,
print_silly_list
(
Report
));
{
info_msg
,
_
GL
,
{
Pid
,
Fmt
,
Args
}}
->
?
LOG
(
info
,
Pid
,
lager
_trunc_io
:
format
(
Fmt
,
Args
,
4096
));
?
LOG
(
info
,
Pid
,
lager
:
safe_
format
(
Fmt
,
Args
,
4096
));
{
info_report
,
_
GL
,
{
Pid
,
std_info
,
D
}}
when
is_list
(
D
)
->
Details
=
lists
:
sort
(
D
),
case
Details
of
...
...
This diff is collapsed.
Click to expand it.
src/lager_crash_log.erl
View file @
83c2a412
...
...
@@ -166,7 +166,7 @@ schedule_rotation(Date) ->
%% to limit the formatted string's size.
limited_fmt
(
Fmt
,
Args
,
FmtMaxBytes
)
->
lager
_trunc_io
:
format
(
Fmt
,
Args
,
FmtMaxBytes
).
lager
:
safe_
format
(
Fmt
,
Args
,
FmtMaxBytes
).
limited_str
(
Term
,
FmtMaxBytes
)
->
{
Str
,
_}
=
lager_trunc_io
:
print
(
Term
,
FmtMaxBytes
),
...
...
This diff is collapsed.
Click to expand it.
test/lager_test_backend.erl
View file @
83c2a412
...
...
@@ -647,6 +647,12 @@ error_logger_redirect_test_() ->
]
}.
safe_format_test
()
->
?
assertEqual
(
"foo bar"
,
lists
:
flatten
(
lager
:
safe_format
(
"
~p
~p
"
,
[
foo
,
bar
],
1024
))),
?
assertEqual
(
"FORMAT ERROR:
\"
~p
~p
~p
\"
[foo,bar]"
,
lists
:
flatten
(
lager
:
safe_format
(
"
~p
~p
~p
"
,
[
foo
,
bar
],
1024
))),
?
assertEqual
(
"FORMAT ERROR:
\"
~s
\"
[1]"
,
lists
:
flatten
(
lager
:
safe_format
(
"
~s
"
,
[
1
],
1024
))),
ok
.
-
endif
.
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment