mirror of
https://github.com/valitydev/woody_erlang.git
synced 2024-11-06 02:15:19 +00:00
4fab3f64af
It's usually needed earlier than the message itself. And may even be used to skip formatting altogether, with `msg_fun()` facility in Erlang logger. Simplify event handler interface which should make this module more usable down the line. Also use monotonic timestamps when measuring time intervals.
32 lines
685 B
Erlang
32 lines
685 B
Erlang
-module(woody_ct_event_h).
|
|
|
|
-behaviour(woody_event_handler).
|
|
-export([handle_event/4]).
|
|
|
|
-define(ESSENTIAL_META, [
|
|
event,
|
|
role,
|
|
service,
|
|
service_schema,
|
|
function,
|
|
type,
|
|
args,
|
|
metadata,
|
|
deadline,
|
|
status,
|
|
url,
|
|
code,
|
|
result
|
|
]).
|
|
|
|
-spec handle_event(
|
|
woody_event_handler:event(),
|
|
woody:rpc_id(),
|
|
woody_event_handler:event_meta(),
|
|
_Prelude
|
|
) -> _.
|
|
handle_event(Event, RpcId, Meta, Prelude) ->
|
|
{Format, Msg} = woody_event_handler:format_event(Event, Meta, RpcId, #{}),
|
|
EvMeta = woody_event_handler:format_meta(Event, Meta, ?ESSENTIAL_META),
|
|
ct:pal("~p " ++ Format ++ "~nmeta: ~p", [Prelude] ++ Msg ++ [EvMeta]).
|