Merge pull request 'Don't crash if ct_log/2 is called when app not running' (#4) from uw-ct_log-fallback into master

Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
2026-06-07 00:57:10 +09:00
+8 -2
View File
@@ -61,13 +61,19 @@ ct_log(Flow, Fmt, Args) ->
TS = timestamp(),
case Flow of
undefined ->
save_log(undefined, TS, Fmt, Args),
maybe_save_log_no_flow(TS, Fmt, Args),
ct:log(Fmt, Args);
Flow ->
save_log(Flow, TS, Fmt, Args),
ct:log("~p[~w]: " ++ Fmt, [Flow, self()|Args])
end.
maybe_save_log_no_flow(TS, Fmt, Args) ->
try save_log(undefined, TS, Fmt, Args)
catch
error:_ ->
ok
end.
save_log(Flow, TS, Fmt, Args) ->
gm_ctflow_log:log(Flow, TS, Fmt, Args).