12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- -ifndef(N2O_HRL).
- -define(N2O_HRL, true).
- -define(FORMAT(F), case F of F when erlang:is_binary(F) -> erlang:binary_to_list(F);
- F when erlang:is_atom(F) -> erlang:atom_to_list(F);
- F when erlang:is_list(F) -> F
- end).
- -ifdef(OTP_RELEASE).
- -include_lib("kernel/include/logger.hrl").
- -else.
- -define(LOG_INFO(F), io:format(?FORMAT(F)) end).
- -define(LOG_INFO(F, X), io:format(?FORMAT(F), X) ).
- -define(LOG_ERROR(F), io:format("{~p,~p}: ~p~n", [?MODULE, ?LINE, F]) ).
- -define(LOG_ERROR(F, X), io:format(?FORMAT(F), X) ).
- -endif.
- -define(LOG_EXCEPTION(E, R, S), ?LOG_ERROR( #{exception => E, reason => R, stack => S} ) ).
- -record(pi, {name :: term(),
- table :: atom(),
- sup :: atom(),
- module :: atom(),
- state :: term()} ).
- -record(cx, {handlers = [] :: list({atom(), atom()}),
- actions = [] :: list(tuple()),
- req = [] :: [] | term(),
- module = [] :: [] | atom() | list(),
- lang = [] :: [] | atom(),
- path = [] :: [] | binary(),
- session = [] :: [] | binary(),
- token = [] :: [] | binary(),
- formatter = bert :: bert | json | atom(),
- params = [] :: [] | list(tuple()) | binary() | list(),
- node = [] :: [] | atom() | list(),
- client_pid= [] :: [] | term(),
- state = [] :: [] | term(),
- from = [] :: [] | binary(),
- vsn = [] :: [] | binary()} ).
- -define(CTX(ClientId), n2o:cache(ClientId) ).
- -define(REQ(ClientId), (n2o:cache(ClientId))#cx.req ).
- %% Nitrogen Protocol
- -include_lib("nitro/include/proto.hrl").
- -endif.
|