diff options
author | Peter Andersson <[email protected]> | 2018-06-04 14:55:08 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2018-06-08 14:40:54 +0200 |
commit | e5bbcfd47088162a1c349eeb5aa3c37d8263d274 (patch) | |
tree | d9e3f2ecbd325faf87e7a80b17c112b0460f35e1 /lib/kernel/src/logger_h_common.hrl | |
parent | 0a235e6b1f008ade99b18438e671b93ff82cc268 (diff) | |
download | otp-e5bbcfd47088162a1c349eeb5aa3c37d8263d274.tar.gz otp-e5bbcfd47088162a1c349eeb5aa3c37d8263d274.tar.bz2 otp-e5bbcfd47088162a1c349eeb5aa3c37d8263d274.zip |
[logger] Change registered name of built-in handlers and use TID for mode table
Diffstat (limited to 'lib/kernel/src/logger_h_common.hrl')
-rw-r--r-- | lib/kernel/src/logger_h_common.hrl | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/kernel/src/logger_h_common.hrl b/lib/kernel/src/logger_h_common.hrl index ed365ce6eb..e4d3431468 100644 --- a/lib/kernel/src/logger_h_common.hrl +++ b/lib/kernel/src/logger_h_common.hrl @@ -77,29 +77,30 @@ -define(DISK_LOG_MAX_NO_BYTES, 1048576). %%%----------------------------------------------------------------- +%%% Utility macros + +-define(name_to_reg_name(MODULE,Name), + list_to_atom(lists:concat([MODULE,"_",Name]))). + +%%%----------------------------------------------------------------- %%% Overload protection macros -define(timestamp(), erlang:monotonic_time(microsecond)). --define(get_mode(HandlerName), - case ets:lookup(HandlerName, mode) of - [{mode,sync}] -> - case whereis(HandlerName)==self() of - true -> async; - _ -> sync - end; +-define(get_mode(Tid), + case ets:lookup(Tid, mode) of [{mode,M}] -> M; _ -> async end). --define(set_mode(HandlerName, M), - begin ets:insert(HandlerName, {mode,M}), M end). +-define(set_mode(Tid, M), + begin ets:insert(Tid, {mode,M}), M end). --define(change_mode(HandlerName, M0, M1), +-define(change_mode(Tid, M0, M1), if M0 == M1 -> M0; true -> - ets:insert(HandlerName, {mode,M1}), + ets:insert(Tid, {mode,M1}), M1 end). @@ -124,7 +125,7 @@ %%% slow down execution and therefore should not be include in code %%% to be officially released. --define(TEST_HOOKS, true). +%%-define(TEST_HOOKS, true). -ifdef(TEST_HOOKS). -define(TEST_HOOKS_TAB, logger_h_test_hooks). |