diff options
author | Siri Hansen <[email protected]> | 2018-05-17 19:45:50 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2018-05-23 11:11:57 +0200 |
commit | 530d3cf99c562e3678eeb08e135ae90c4df4e052 (patch) | |
tree | 404a5203d7eaa66e1b9eab22c855a637baae5194 | |
parent | 51c6464a011eacd78340b60e2641eaecc36933f6 (diff) | |
download | otp-530d3cf99c562e3678eeb08e135ae90c4df4e052.tar.gz otp-530d3cf99c562e3678eeb08e135ae90c4df4e052.tar.bz2 otp-530d3cf99c562e3678eeb08e135ae90c4df4e052.zip |
Rename module logger_simple to logger_simple_h
Also, change HandlerId from logger_simple to simple.
-rw-r--r-- | lib/kernel/src/Makefile | 4 | ||||
-rw-r--r-- | lib/kernel/src/kernel.app.src | 2 | ||||
-rw-r--r-- | lib/kernel/src/logger.erl | 10 | ||||
-rw-r--r-- | lib/kernel/src/logger_server.erl | 9 | ||||
-rw-r--r-- | lib/kernel/src/logger_simple_h.erl (renamed from lib/kernel/src/logger_simple.erl) | 6 | ||||
-rw-r--r-- | lib/kernel/test/Makefile | 2 | ||||
-rw-r--r-- | lib/kernel/test/logger.cover | 2 | ||||
-rw-r--r-- | lib/kernel/test/logger.spec | 2 | ||||
-rw-r--r-- | lib/kernel/test/logger_env_var_SUITE.erl | 44 | ||||
-rw-r--r-- | lib/kernel/test/logger_simple_h_SUITE.erl (renamed from lib/kernel/test/logger_simple_SUITE.erl) | 22 | ||||
-rw-r--r-- | lib/sasl/src/systools_make.erl | 2 |
11 files changed, 52 insertions, 53 deletions
diff --git a/lib/kernel/src/Makefile b/lib/kernel/src/Makefile index eeb8c6ab2f..f265fdd272 100644 --- a/lib/kernel/src/Makefile +++ b/lib/kernel/src/Makefile @@ -118,7 +118,7 @@ MODULES = \ logger_filters \ logger_formatter \ logger_server \ - logger_simple \ + logger_simple_h \ logger_sup \ net \ net_adm \ @@ -279,7 +279,7 @@ $(EBIN)/logger_disk_log_h.beam: logger_h_common.hrl logger_internal.hrl ../inclu $(EBIN)/logger_filters.beam: logger_internal.hrl ../include/logger.hrl $(EBIN)/logger_formatter.beam: logger_internal.hrl ../include/logger.hrl $(EBIN)/logger_server.beam: logger_internal.hrl ../include/logger.hrl -$(EBIN)/logger_simple.beam: logger_internal.hrl ../include/logger.hrl +$(EBIN)/logger_simple_h.beam: logger_internal.hrl ../include/logger.hrl $(EBIN)/logger_std_h.beam: logger_h_common.hrl logger_internal.hrl ../include/logger.hrl ../include/file.hrl $(EBIN)/logger_h_common.beam: logger_h_common.hrl logger_internal.hrl ../include/logger.hrl $(EBIN)/net_kernel.beam: ../include/net_address.hrl diff --git a/lib/kernel/src/kernel.app.src b/lib/kernel/src/kernel.app.src index 46fb3e09d5..d873178f55 100644 --- a/lib/kernel/src/kernel.app.src +++ b/lib/kernel/src/kernel.app.src @@ -68,7 +68,7 @@ logger_formatter, logger_h_common, logger_server, - logger_simple, + logger_simple_h, logger_std_h, logger_sup, net, diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl index b32fca1fda..f35036aa04 100644 --- a/lib/kernel/src/logger.erl +++ b/lib/kernel/src/logger.erl @@ -561,10 +561,10 @@ internal_init_logger() -> end || Module <- Modules] || {module_level, Level, Modules} <- get_logger_env()], - case logger:set_handler_config(logger_simple,filters, + case logger:set_handler_config(simple,filters, get_default_handler_filters()) of ok -> ok; - {error,{not_found,logger_simple}} -> ok + {error,{not_found,simple}} -> ok end, init_kernel_handlers() @@ -580,7 +580,7 @@ init_kernel_handlers() -> try case get_logger_type() of {ok,silent} -> - ok = logger:remove_handler(logger_simple); + ok = logger:remove_handler(simple); {ok,false} -> ok; {ok,Type} -> @@ -621,9 +621,9 @@ add_handlers(HandlerConfig) -> %% If a default handler was added we try to remove the simple_logger %% If the simple logger exists it will replay its log events %% to the handler(s) added in the fold above. - _ = [case logger:remove_handler(logger_simple) of + _ = [case logger:remove_handler(simple) of ok -> ok; - {error,{not_found,logger_simple}} -> ok + {error,{not_found,simple}} -> ok end || DefaultAdded], ok catch throw:Reason -> diff --git a/lib/kernel/src/logger_server.erl b/lib/kernel/src/logger_server.erl index 9182b0b486..47010c9fa5 100644 --- a/lib/kernel/src/logger_server.erl +++ b/lib/kernel/src/logger_server.erl @@ -127,15 +127,14 @@ init([]) -> process_flag(trap_exit, true), Tid = logger_config:new(?LOGGER_TABLE), LoggerConfig = maps:merge(default_config(logger), - #{handlers=>[logger_simple]}), + #{handlers=>[simple]}), logger_config:create(Tid,logger,LoggerConfig), - SimpleConfig0 = maps:merge(default_config(logger_simple), + SimpleConfig0 = maps:merge(default_config(simple), #{filter_default=>stop, filters=>?DEFAULT_HANDLER_FILTERS}), %% If this fails, then the node should crash - {ok,SimpleConfig} = - logger_simple:adding_handler(SimpleConfig0), - logger_config:create(Tid,logger_simple,logger_simple,SimpleConfig), + {ok,SimpleConfig} = logger_simple_h:adding_handler(SimpleConfig0), + logger_config:create(Tid,simple,logger_simple_h,SimpleConfig), {ok, #state{tid=Tid, async_req_queue = queue:new()}}. handle_call({add_handler,Id,Module,HConfig}, From, #state{tid=Tid}=State) -> diff --git a/lib/kernel/src/logger_simple.erl b/lib/kernel/src/logger_simple_h.erl index cfb3fcb620..19fb3b54ba 100644 --- a/lib/kernel/src/logger_simple.erl +++ b/lib/kernel/src/logger_simple_h.erl @@ -17,7 +17,7 @@ %% %% %CopyrightEnd% %% --module(logger_simple). +-module(logger_simple_h). -export([adding_handler/1, removing_handler/1, log/2]). @@ -27,7 +27,7 @@ %%%----------------------------------------------------------------- %%% Logger callback -adding_handler(#{id:=?MODULE}=Config) -> +adding_handler(#{id:=simple}=Config) -> Me = self(), case whereis(?MODULE) of undefined -> @@ -44,7 +44,7 @@ adding_handler(#{id:=?MODULE}=Config) -> {error,{handler_process_name_already_exists,?MODULE}} end. -removing_handler(#{id:=?MODULE}) -> +removing_handler(#{id:=simple}) -> case whereis(?MODULE) of undefined -> ok; diff --git a/lib/kernel/test/Makefile b/lib/kernel/test/Makefile index 2f637ca9de..2ad1e3107c 100644 --- a/lib/kernel/test/Makefile +++ b/lib/kernel/test/Makefile @@ -77,7 +77,7 @@ MODULES= \ logger_filters_SUITE \ logger_formatter_SUITE \ logger_legacy_SUITE \ - logger_simple_SUITE \ + logger_simple_h_SUITE \ logger_std_h_SUITE \ logger_test_lib \ os_SUITE \ diff --git a/lib/kernel/test/logger.cover b/lib/kernel/test/logger.cover index b30bcfe920..960bc0abff 100644 --- a/lib/kernel/test/logger.cover +++ b/lib/kernel/test/logger.cover @@ -8,7 +8,7 @@ logger_filters, logger_formatter, logger_server, - logger_simple, + logger_simple_h, logger_std_h, logger_sup]}. diff --git a/lib/kernel/test/logger.spec b/lib/kernel/test/logger.spec index cd76a754a4..1ab90b3e93 100644 --- a/lib/kernel/test/logger.spec +++ b/lib/kernel/test/logger.spec @@ -7,5 +7,5 @@ logger_filters_SUITE, logger_formatter_SUITE, logger_legacy_SUITE, - logger_simple_SUITE, + logger_simple_h_SUITE, logger_std_h_SUITE]}. diff --git a/lib/kernel/test/logger_env_var_SUITE.erl b/lib/kernel/test/logger_env_var_SUITE.erl index a808a31f17..601d331fb0 100644 --- a/lib/kernel/test/logger_env_var_SUITE.erl +++ b/lib/kernel/test/logger_env_var_SUITE.erl @@ -85,7 +85,7 @@ default(Config) -> {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} = lists:keyfind(domain,1,StdFilters), true = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -98,7 +98,7 @@ default_sasl_compatible(Config) -> {domain,{_,{log,super,[beam,erlang,otp]}}} = lists:keyfind(domain,1,StdFilters), false = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), true = lists:keymember(sasl,1,Hs), ok. @@ -110,7 +110,7 @@ error_logger_tty(Config) -> {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} = lists:keyfind(domain,1,StdFilters), true = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -124,7 +124,7 @@ error_logger_tty_sasl_compatible(Config) -> {domain,{_,{log,super,[beam,erlang,otp]}}} = lists:keyfind(domain,1,StdFilters), false = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), true = lists:keymember(sasl,1,Hs), ok. @@ -134,7 +134,7 @@ error_logger_false(Config) -> [{error_logger,false}, {logger_level,notice}]), false = lists:keymember(?STANDARD_HANDLER,1,Hs), - {logger_simple,logger_simple,SimpleC} = lists:keyfind(logger_simple,1,Hs), + {simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs), info = maps:get(level,SimpleC), notice = maps:get(level,L), SimpleFilters = maps:get(filters,SimpleC), @@ -151,7 +151,7 @@ error_logger_false_progress(Config) -> {logger_level,notice}, {logger_progress_reports,log}]), false = lists:keymember(?STANDARD_HANDLER,1,Hs), - {logger_simple,logger_simple,SimpleC} = lists:keyfind(logger_simple,1,Hs), + {simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs), info = maps:get(level,SimpleC), notice = maps:get(level,L), SimpleFilters = maps:get(filters,SimpleC), @@ -168,7 +168,7 @@ error_logger_false_sasl_compatible(Config) -> {logger_level,notice}, {logger_sasl_compatible,true}]), false = lists:keymember(?STANDARD_HANDLER,1,Hs), - {logger_simple,logger_simple,SimpleC} = lists:keyfind(logger_simple,1,Hs), + {simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs), info = maps:get(level,SimpleC), notice = maps:get(level,L), SimpleFilters = maps:get(filters,SimpleC), @@ -182,7 +182,7 @@ error_logger_silent(Config) -> {ok,#{handlers:=Hs},_Node} = setup(Config, [{error_logger,silent}]), false = lists:keymember(?STANDARD_HANDLER,1,Hs), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -191,7 +191,7 @@ error_logger_silent_sasl_compatible(Config) -> [{error_logger,silent}, {logger_sasl_compatible,true}]), false = lists:keymember(?STANDARD_HANDLER,1,Hs), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), true = lists:keymember(sasl,1,Hs), ok. @@ -223,7 +223,7 @@ logger_file(Config) -> {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} = lists:keyfind(domain,1,StdFilters), true = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -246,7 +246,7 @@ logger_file_sasl_compatible(Config) -> {domain,{_,{log,super,[beam,erlang,otp]}}} = lists:keyfind(domain,1,StdFilters), false = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), true = lists:keymember(sasl,1,Hs), ok. @@ -269,7 +269,7 @@ logger_file_log_progress(Config) -> {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} = lists:keyfind(domain,1,StdFilters), false = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -289,7 +289,7 @@ logger_file_no_filter(Config) -> {?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs), info = maps:get(level,StdC), [] = maps:get(filters,StdC), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -310,7 +310,7 @@ logger_file_no_filter_level(Config) -> {?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs), error = maps:get(level,StdC), [] = maps:get(filters,StdC), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -331,7 +331,7 @@ logger_file_formatter(Config) -> {?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs), info = maps:get(level,StdC), [] = maps:get(filters,StdC), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -356,7 +356,7 @@ logger_filters(Config) -> {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} = lists:keyfind(domain,1,StdFilters), false = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), LoggerFilters = maps:get(filters,Logger), true = lists:keymember(stop_progress,1,LoggerFilters), @@ -382,8 +382,8 @@ logger_filters_stop(Config) -> {?STANDARD_HANDLER,logger_std_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs), info = maps:get(level,StdC), [] = maps:get(filters,StdC), - false = lists:keymember(logger_simple,1,Hs), - false = lists:keymember(sasl_h,1,Hs), + false = lists:keymember(simple,1,Hs), + false = lists:keymember(sasl,1,Hs), LoggerFilters = maps:get(filters,Logger), true = lists:keymember(log_error,1,LoggerFilters), @@ -409,7 +409,7 @@ logger_module_level(Config) -> {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} = lists:keyfind(domain,1,StdFilters), false = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), [{supervisor,error}] = ModuleLevels, ok. @@ -431,7 +431,7 @@ logger_disk_log(Config) -> {domain,{_,{log,super,[beam,erlang,otp,sasl]}}} = lists:keyfind(domain,1,StdFilters), true = lists:keymember(stop_progress,1,StdFilters), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -452,7 +452,7 @@ logger_disk_log_formatter(Config) -> {?STANDARD_HANDLER,logger_disk_log_h,StdC} = lists:keyfind(?STANDARD_HANDLER,1,Hs), info = maps:get(level,StdC), [] = maps:get(filters,StdC), - false = lists:keymember(logger_simple,1,Hs), + false = lists:keymember(simple,1,Hs), false = lists:keymember(sasl,1,Hs), ok. @@ -461,7 +461,7 @@ logger_undefined(Config) -> {ok,#{handlers:=Hs,logger:=L},_Node} = setup(Config,[{logger,[{handler,?STANDARD_HANDLER,undefined}]}]), false = lists:keymember(?STANDARD_HANDLER,1,Hs), - {logger_simple,logger_simple,SimpleC} = lists:keyfind(logger_simple,1,Hs), + {simple,logger_simple_h,SimpleC} = lists:keyfind(simple,1,Hs), info = maps:get(level,SimpleC), info = maps:get(level,L), SimpleFilters = maps:get(filters,SimpleC), diff --git a/lib/kernel/test/logger_simple_SUITE.erl b/lib/kernel/test/logger_simple_h_SUITE.erl index d7f9fa21cf..271a2126de 100644 --- a/lib/kernel/test/logger_simple_SUITE.erl +++ b/lib/kernel/test/logger_simple_h_SUITE.erl @@ -17,7 +17,7 @@ %% %% %CopyrightEnd% %% --module(logger_simple_SUITE). +-module(logger_simple_h_SUITE). -compile(export_all). @@ -87,20 +87,20 @@ all() -> ]. start_stop(_Config) -> - undefined = whereis(logger_simple), - register(logger_simple,self()), - {error,_} = logger:add_handler(logger_simple, - logger_simple, + undefined = whereis(logger_simple_h), + register(logger_simple_h,self()), + {error,_} = logger:add_handler(simple, + logger_simple_h, #{filter_default=>log}), - unregister(logger_simple), - ok = logger:add_handler(logger_simple,logger_simple,#{filter_default=>log}), - Pid = whereis(logger_simple), + unregister(logger_simple_h), + ok = logger:add_handler(simple,logger_simple_h,#{filter_default=>log}), + Pid = whereis(logger_simple_h), true = is_pid(Pid), - ok = logger:remove_handler(logger_simple), - false = is_pid(whereis(logger_simple)), + ok = logger:remove_handler(simple), + false = is_pid(whereis(logger_simple_h)), ok. start_stop(cleanup,_Config) -> - logger:remove_handler(logger_simple). + logger:remove_handler(simple). %% This testcase just tests that it does not crash, the default handler prints %% to stdout which we cannot read from in a detached slave. diff --git a/lib/sasl/src/systools_make.erl b/lib/sasl/src/systools_make.erl index f4b1b54fd1..6916107623 100644 --- a/lib/sasl/src/systools_make.erl +++ b/lib/sasl/src/systools_make.erl @@ -1551,7 +1551,7 @@ mandatory_modules() -> logger_server, logger_backend, logger_config, - logger_simple, + logger_simple_h, lists, proc_lib, supervisor |