From 5e45b515721bc64fbfd377476d904ee4b7b83f0b Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Mon, 1 Feb 2021 20:17:09 +0800 Subject: [PATCH] =?UTF-8?q?ft:=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nsoleBackend.erl => rumBackendConsole.erl} | 18 +-------- ...{rumFileBackend.erl => rumBackendFile.erl} | 2 +- src/eRum.app.src | 2 +- src/eRum_app.erl | 2 +- src/watcher/rumHandlerWatcherSup.erl | 39 ------------------- ...lerWatcherSrv.erl => rumHleWatcherSrv.erl} | 2 +- src/watcher/rumHleWatcherSup.erl | 23 +++++++++++ 7 files changed, 28 insertions(+), 60 deletions(-) rename src/backend/{rumConsoleBackend.erl => rumBackendConsole.erl} (97%) rename src/backend/{rumFileBackend.erl => rumBackendFile.erl} (99%) delete mode 100644 src/watcher/rumHandlerWatcherSup.erl rename src/watcher/{rumHandlerWatcherSrv.erl => rumHleWatcherSrv.erl} (99%) create mode 100644 src/watcher/rumHleWatcherSup.erl diff --git a/src/backend/rumConsoleBackend.erl b/src/backend/rumBackendConsole.erl similarity index 97% rename from src/backend/rumConsoleBackend.erl rename to src/backend/rumBackendConsole.erl index 21b7989..2fcc43a 100644 --- a/src/backend/rumConsoleBackend.erl +++ b/src/backend/rumBackendConsole.erl @@ -1,19 +1,3 @@ -%% Copyright (c) 2011-2012, 2014 Basho Technologies, Inc. All Rights Reserved. -%% -%% This file is provided to you under the Apache License, -%% Version 2.0 (the "License"); you may not use this file -%% except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, -%% software distributed under the License is distributed on an -%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -%% KIND, either express or implied. See the License for the -%% specific language governing permissions and limitations -%% under the License. - %% @doc Console backend for lager. %% Configuration is a proplist with the following keys: %% --module(rumConsoleBackend). +-module(rumBackendConsole). -behaviour(gen_event). diff --git a/src/backend/rumFileBackend.erl b/src/backend/rumBackendFile.erl similarity index 99% rename from src/backend/rumFileBackend.erl rename to src/backend/rumBackendFile.erl index 3ac5724..c9a5832 100644 --- a/src/backend/rumFileBackend.erl +++ b/src/backend/rumBackendFile.erl @@ -12,7 +12,7 @@ %% sync at specific log levels, configured via the `sync_on' option. By default %% the error level or above will trigger a sync. --module(rumFileBackend). +-module(rumBackendFile). -include("rum.hrl"). -include_lib("kernel/include/file.hrl"). diff --git a/src/eRum.app.src b/src/eRum.app.src index d5e65d4..5369bb8 100644 --- a/src/eRum.app.src +++ b/src/eRum.app.src @@ -4,7 +4,7 @@ {vsn, "0.1.0"}, {modules, []}, {applications, [kernel, stdlib, goldrush]}, - {registered, [eRum_sup, lager_event, rumCrashLog, rumHandlerWatcherSup]}, + {registered, [eRum_sup, lager_event, rumCrashLog, rumHleWatcherSup]}, {mod, {eRum_app, []}}, {env, [ %% Note: application:start(lager) overwrites previously defined environment variables thus declaration of default handlers is done at lager_app.erl diff --git a/src/eRum_app.erl b/src/eRum_app.erl index 38b0ee5..e3e0205 100644 --- a/src/eRum_app.erl +++ b/src/eRum_app.erl @@ -238,7 +238,7 @@ expand_handlers([{lager_file_backend, [{Key, _Value} | _] = Config} | T]) when i [maybe_make_handler_id(lager_file_backend, Config) | expand_handlers(T)]; expand_handlers([{lager_file_backend, Configs} | T]) -> ?INT_LOG(notice, "Deprecated lager_file_backend config detected, please consider updating it", []), - [{rumFileBackend:config_to_id(Config), Config} || Config <- Configs] ++ + [{rumBackendFile:config_to_id(Config), Config} || Config <- Configs] ++ expand_handlers(T); expand_handlers([{Mod, Config} | T]) when is_atom(Mod) -> [maybe_make_handler_id(Mod, Config) | expand_handlers(T)]; diff --git a/src/watcher/rumHandlerWatcherSup.erl b/src/watcher/rumHandlerWatcherSup.erl deleted file mode 100644 index e8ef652..0000000 --- a/src/watcher/rumHandlerWatcherSup.erl +++ /dev/null @@ -1,39 +0,0 @@ -%% Copyright (c) 2011-2012 Basho Technologies, Inc. All Rights Reserved. -%% -%% This file is provided to you under the Apache License, -%% Version 2.0 (the "License"); you may not use this file -%% except in compliance with the License. You may obtain -%% a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, -%% software distributed under the License is distributed on an -%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -%% KIND, either express or implied. See the License for the -%% specific language governing permissions and limitations -%% under the License. - -%% @doc A supervisor for monitoring lager_handler_watcher processes. - -%% @private - --module(rumHandlerWatcherSup). - --behaviour(supervisor). - -%% API --export([start_link/0]). - -%% Callbacks --export([init/1]). - -start_link() -> - supervisor:start_link({local, ?MODULE}, ?MODULE, []). - -init([]) -> - {ok, {{simple_one_for_one, 10, 60}, - [ - {lager_handler_watcher, {lager_handler_watcher, start_link, []}, - temporary, 5000, worker, [lager_handler_watcher]} - ]}}. diff --git a/src/watcher/rumHandlerWatcherSrv.erl b/src/watcher/rumHleWatcherSrv.erl similarity index 99% rename from src/watcher/rumHandlerWatcherSrv.erl rename to src/watcher/rumHleWatcherSrv.erl index 9e46879..9e800bc 100644 --- a/src/watcher/rumHandlerWatcherSrv.erl +++ b/src/watcher/rumHleWatcherSrv.erl @@ -19,7 +19,7 @@ %% @private --module(rumHandlerWatcherSrv). +-module(rumHleWatcherSrv). -behaviour(gen_server). diff --git a/src/watcher/rumHleWatcherSup.erl b/src/watcher/rumHleWatcherSup.erl new file mode 100644 index 0000000..f25ef49 --- /dev/null +++ b/src/watcher/rumHleWatcherSup.erl @@ -0,0 +1,23 @@ +%% @doc A supervisor for monitoring lager_handler_watcher processes. + +%% @private + +-module(rumHleWatcherSup). + +-behaviour(supervisor). + +%% API +-export([start_link/0]). + +%% Callbacks +-export([init/1]). + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +init([]) -> + {ok, {{simple_one_for_one, 10, 60}, + [ + {lager_handler_watcher, {lager_handler_watcher, start_link, []}, + temporary, 5000, worker, [lager_handler_watcher]} + ]}}.