@ -104,7 +104,7 @@ handle_event(Event, #state{sink = Sink, shaper = Shaper} = State) ->
true - >
{ ok , State #state { shaper = NewShaper } } ;
_ - >
? LOGFMT ( Sink , ? warning , self ( ) , " lgErrLoggerH dropped ~p messages in the last second that exceeded the limit of ~p messages/sec " , [ Drop , NewShaper #lgShaper.hwm ] ) ,
? LOGFMT ( Sink , ? warning , self ( ) , < < " lgErrLoggerH dropped ~p messages in the last second that exceeded the limit of ~p messages/sec "; > > ; , [ Drop , NewShaper #lgShaper.hwm ] ) ,
evalGl ( Event , State #state { shaper = NewShaper } )
end ;
{ false , _ , NewShaper } - >
@ -116,7 +116,7 @@ handle_info({mShaperExpired, ?MODULE}, #state{sink = Sink, shaper = Shaper} = St
0 - >
ignore ;
Dropped - >
? LOGFMT ( Sink , ? warning , self ( ) , " lgErrLoggerH dropped ~p messages in the last second that exceeded the limit of ~p messages/sec " , [ Dropped , Shaper #lgShaper.hwm ] )
? LOGFMT ( Sink , ? warning , self ( ) , < < " lgErrLoggerH dropped ~p messages in the last second that exceeded the limit of ~p messages/sec "; > > ; , [ Dropped , Shaper #lgShaper.hwm ] )
end ,
{ ok , State #state { shaper = Shaper #lgShaper { dropped = 0 } } } ;
handle_info ( _ Info , State ) - >
@ -186,7 +186,7 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
end ,
? CRASH_LOG ( Event ) ,
{ Md , Formatted } = formatReasonMd ( Reason ) ,
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , " gen_server ~w terminated with reason: ~s " , [ Name , Formatted ] ) ;
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , < < " gen_server ~w terminated with reason: ~s "; > > ; , [ Name , Formatted ] ) ;
" ** gen_ipc State machine " ++ _ - >
% % gen_server terminate
{ Reason , Name } =
@ -203,7 +203,7 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
end ,
? CRASH_LOG ( Event ) ,
{ Md , Formatted } = formatReasonMd ( Reason ) ,
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , " gen_ipc ~w terminated with reason: ~s " , [ Name , Formatted ] ) ;
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , < < " gen_ipc ~w terminated with reason: ~s "; > > ; , [ Name , Formatted ] ) ;
" ** State machine " ++ _ - >
% % Check if the terminated process is gen_fsm or gen_statem
% % since they generate the same exit message
@ -226,13 +226,13 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
end ,
{ Md , Formatted } = formatReasonMd ( Reason ) ,
? CRASH_LOG ( Event ) ,
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , " ~s ~w in state ~w terminated with reason: ~s " , [ Type , Name , StateName , Formatted ] ) ;
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , < < " ~s ~w in state ~w terminated with reason: ~s "; > > ; , [ Type , Name , StateName , Formatted ] ) ;
" ** gen_event handler " ++ _ - >
% % gen_event handler terminate
[ ID , Name , _ Msg , _ State , Reason ] = Args ,
{ Md , Formatted } = formatReasonMd ( Reason ) ,
? CRASH_LOG ( Event ) ,
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , " gen_event ~w installed in ~w terminated with reason: ~s " , [ ID , Name , Formatted ] ) ;
? LOGFMT ( Sink , ? error , [ { pid , Pid } , { name , Name } | Md ] , < < " gen_event ~w installed in ~w terminated with reason: ~s "; > > ; , [ ID , Name , Formatted ] ) ;
" ** Cowboy handler " ++ _ - >
% % Cowboy HTTP server error
? CRASH_LOG ( Event ) ,
@ -240,14 +240,14 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
[ Module , Function , Arity , _ Request , _ State ] - >
% % we only get the 5 - element list when its a non - exported function
? LOGFMT ( Sink , ? error , Pid ,
" Cowboy handler ~p terminated with reason: call to undefined function ~p : ~p / ~p " ,
< < " Cowboy handler ~p terminated with reason: call to undefined function ~p : ~p / ~p "; > > ; ,
[ Module , Module , Function , Arity ] ) ;
[ Module , Function , Arity , _ Class , Reason | Tail ] - >
% % any other cowboy error_format list * always * ends with the stacktrace
StackTrace = lists : last ( Tail ) ,
{ Md , Formatted } = formatReasonMd ( { Reason , StackTrace } ) ,
? LOGFMT ( Sink , ? error , [ { pid , Pid } | Md ] ,
" Cowboy handler ~p terminated in ~p : ~p / ~p with reason: ~s " , [ Module , Module , Function , Arity , Formatted ] )
< < " Cowboy handler ~p terminated in ~p : ~p / ~p with reason: ~s "; > > ; , [ Module , Module , Function , Arity , Formatted ] )
end ;
" Ranch listener " ++ _ - >
% % Ranch errors
@ -257,18 +257,18 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
[ Ref , ConnectionPid , StreamID , RequestPid , Reason , StackTrace ] - >
{ Md , Formatted } = formatReasonMd ( { Reason , StackTrace } ) ,
? LOGFMT ( Sink , ? error , [ { pid , RequestPid } | Md ] ,
" Cowboy stream ~p with ranch listener ~p and connection process ~p "
" had its request process exit with reason: ~s " , [ StreamID , Ref , ConnectionPid , Formatted ] ) ;
< < " Cowboy stream ~p with ranch listener ~p and connection process ~p "
" had its request process exit with reason: ~s " > > , [ StreamID , Ref , ConnectionPid , Formatted ] ) ;
[ Ref , _ Protocol , Worker , { [ { reason , Reason } , { mfa , { Module , Function , Arity } } , { stacktrace , StackTrace } | _ ] , _ } ] - >
{ Md , Formatted } = formatReasonMd ( { Reason , StackTrace } ) ,
? LOGFMT ( Sink , ? error , [ { pid , Worker } | Md ] , " Ranch listener ~p terminated in ~p : ~p / ~p with reason: ~s " , [ Ref , Module , Function , Arity , Formatted ] ) ;
? LOGFMT ( Sink , ? error , [ { pid , Worker } | Md ] , < < " Ranch listener ~p terminated in ~p : ~p / ~p with reason: ~s "; > > ; , [ Ref , Module , Function , Arity , Formatted ] ) ;
[ Ref , _ Protocol , Worker , Reason ] - >
{ Md , Formatted } = formatReasonMd ( Reason ) ,
? LOGFMT ( Sink , ? error , [ { pid , Worker } | Md ] , " Ranch listener ~p terminated with reason: ~s " , [ Ref , Formatted ] ) ;
? LOGFMT ( Sink , ? error , [ { pid , Worker } | Md ] , < < " Ranch listener ~p terminated with reason: ~s "; > > ; , [ Ref , Formatted ] ) ;
[ Ref , Protocol , Ret ] - >
% % ranch_conns_sup . erl module line 119 - 123 has three parameters error msg , log it .
{ Md , Formatted } = formatReasonMd ( Ret ) ,
? LOGFMT ( Sink , ? error , [ { pid , Protocol } | Md ] , " Ranch listener ~p terminated with result: ~s " , [ Ref , Formatted ] )
? LOGFMT ( Sink , ? error , [ { pid , Protocol } | Md ] , < < " Ranch listener ~p terminated with result: ~s "; > > ; , [ Ref , Formatted ] )
end ;
" webmachine error " ++ _ - >
% % Webmachine HTTP server error
@ -283,7 +283,7 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
Error
end ,
{ Md , Formatted } = formatReasonMd ( StackTrace ) ,
? LOGFMT ( Sink , ? error , [ { pid , Pid } | Md ] , " Webmachine error at path ~p : ~s " , [ Path , Formatted ] ) ;
? LOGFMT ( Sink , ? error , [ { pid , Pid } | Md ] , < < " Webmachine error at path ~p : ~s "; > > ; , [ Path , Formatted ] ) ;
_ - >
? CRASH_LOG ( Event ) ,
? LOGFMT ( Sink , ? error , Pid , Fmt , Args )
@ -302,7 +302,7 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
Offender = formatOffender ( Off ) ,
{ Md , Formatted } = formatReasonMd ( Reason ) ,
? LOGFMT ( Sink , ? error , [ { pid , Pid } | Md ] ,
" Supervisor ~w had child ~s exit with reason ~s in context ~w " ,
< < " Supervisor ~w had child ~s exit with reason ~s in context ~w "; > > ; ,
[ supervisorName ( Name ) , Offender , Formatted , Ctx ] ) ;
_ - >
? LOGMSG ( Sink , ? error , Pid , < < " SUPERVISOR REPORT " , ( printSillyList ( D ) ) / binary > > )
@ -310,7 +310,7 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
{ error_report , _ GL , { Pid , crash_report , [ Self , Neighbours ] } } - >
? CRASH_LOG ( Event ) ,
{ Md , Formatted } = formatCrashReport ( Self , Neighbours ) ,
? LOGMSG ( Sink , ? error , [ { pid , Pid } | Md ] , " CRASH REPORT " ++ Formatted ) ;
? LOGMSG ( Sink , ? error , [ { pid , Pid } | Md ] , < < " CRASH REPORT " , Formatted / binary > > ) ;
{ warning_msg , _ GL , { Pid , Fmt , Args } } - >
? LOGFMT ( Sink , ? warning , Pid , Fmt , Args ) ;
{ warning_report , _ GL , { Pid , std_warning , Report } } - >
@ -326,7 +326,7 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
no_log ;
_ - >
{ Md , Formatted } = formatReasonMd ( Reason ) ,
? LOGFMT ( Sink , ? info , [ { pid , Pid } | Md ] , " Application ~w exited with reason: ~s " , [ App , Formatted ] )
? LOGFMT ( Sink , ? info , [ { pid , Pid } | Md ] , < < " Application ~w exited with reason: ~s "; > > ; , [ App , Formatted ] )
end ;
_ - >
? LOGMSG ( Sink , ? info , Pid , printSillyList ( D ) )
@ -341,7 +341,7 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
true - >
no_log ;
_ - >
? LOGFMT ( Sink , ? info , P , " Application ~w started on node ~w " , [ App , Node ] )
? LOGFMT ( Sink , ? info , P , < < " Application ~w started on node ~w "; > > ; , [ App , Node ] )
end ;
[ { started , Started } , { supervisor , Name } ] - >
case lgUtil : get_env ( suppressSupStartStop , false ) of
@ -350,14 +350,14 @@ logEvent(Event, #state{sink = Sink, raw = FormatRaw} = State) ->
_ - >
MFA = formatMfa ( get_value ( mfargs , Started ) ) ,
Pid = get_value ( pid , Started ) ,
? LOGFMT ( Sink , ? debug , P , " Supervisor ~w started ~s at pid ~w " ,
? LOGFMT ( Sink , ? debug , P , < < " Supervisor ~w started ~s at pid ~w "; > > ; ,
[ supervisorName ( Name ) , MFA , Pid ] )
end ;
_ - >
? LOGMSG ( Sink , ? info , P , < < " PROGRESS REPORT " , ( printSillyList ( D ) ) / binary > > )
end ;
_ - >
? LOGFMT ( Sink , ? warning , self ( ) , " Unexpected error_logger event ~w " , [ Event ] )
? LOGFMT ( Sink , ? warning , self ( ) , < < " Unexpected error_logger event ~w "; > > ; , [ Event ] )
end ,
case DidLog of
logged - >
@ -388,7 +388,7 @@ formatCrashReport(Report, Neighbours) ->
{ Class , Reason , Trace } = get_value ( error_info , Report ) ,
{ Md , ReasonStr } = formatReasonMd ( { Reason , Trace } ) ,
Type = ? IIF ( Class == exit , < < " exited " > > , < < " crashed " > > ) ,
{ Md0 ++ Md , eFmt : formatBin ( " Process ~w with ~w neighbours ~s with reason: ~s " , [ Name , length ( Neighbours ) , Type , ReasonStr ] ) } .
{ Md0 ++ Md , eFmt : formatBin ( < < " Process ~w with ~w neighbours ~s with reason: ~s "; > > ; , [ Name , length ( Neighbours ) , Type , ReasonStr ] ) } .
formatOffender ( Off ) - >
case get_value ( mfargs , Off ) of
@ -499,7 +499,7 @@ formatReasonMd({{badarg, Stack}, _}) ->
formatReasonMd ( { { badarity , { Fun , Args } } , [ MFA | _ ] } ) - >
{ arity , Arity } = lists : keyfind ( arity , 1 , erlang : fun_info ( Fun ) ) ,
{ Md , Formatted } = formatMfaMd ( MFA ) ,
{ [ { reason , badarity } | Md ] , eFmt : formatBin ( " fun called with wrong arity of ~w instead of ~w in ~s " , [ length ( Args ) , Arity , Formatted ] ) } ;
{ [ { reason , badarity } | Md ] , eFmt : formatBin ( < < " fun called with wrong arity of ~w instead of ~w in ~s "; > > ; , [ length ( Args ) , Arity , Formatted ] ) } ;
formatReasonMd ( { noproc , MFA } ) - >
{ Md , Formatted } = formatMfaMd ( MFA ) ,
{ [ { reason , noproc } | Md ] , < < " no such process or port in call to " , Formatted / binary > > } ;