Browse Source

Don't start the crash logger if its not configured

pull/4/head
Andrew Thompson 14 years ago
parent
commit
3c7eb575d3
1 changed files with 17 additions and 8 deletions
  1. +17
    -8
      src/lager_sup.erl

+ 17
- 8
src/lager_sup.erl View File

@ -28,12 +28,21 @@ start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
Children = [
{lager, {gen_event, start_link, [{local, lager_event}]},
permanent, 5000, worker, [dynamic]},
{lager_handler_watcher_sup, {lager_handler_watcher_sup, start_link, []},
permanent, 5000, supervisor, [lager_handler_watcher_sup]}],
%% check if the crash log is enabled
Crash = case application:get_env(lager, crash_log) of
{ok, File} ->
[{lager_crash_log, {lager_crash_log, start_link, [File]},
permanent, 5000, worker, [lager_crash_log]}];
_ ->
[]
end,
{ok, {{one_for_one, 1000, 3600},
[
{lager, {gen_event, start_link, [{local, lager_event}]},
permanent, 5000, worker, [dynamic]},
{lager_crash_log, {lager_crash_log, start_link, ["log/crash.log"]},
permanent, 5000, worker, [lager_crash_log]},
{lager_handler_watcher_sup, {lager_handler_watcher_sup, start_link, []},
permanent, 5000, supervisor, [lager_handler_watcher_sup]}
]}}.
Children ++ Crash
}}.

Loading…
Cancel
Save