Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

52 řádky
1.5 KiB

před 14 roky
  1. %% Copyright (c) 2011 Basho Technologies, Inc. All Rights Reserved.
  2. %%
  3. %% This file is provided to you under the Apache License,
  4. %% Version 2.0 (the "License"); you may not use this file
  5. %% except in compliance with the License. You may obtain
  6. %% a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing,
  11. %% software distributed under the License is distributed on an
  12. %% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. %% KIND, either express or implied. See the License for the
  14. %% specific language governing permissions and limitations
  15. %% under the License.
  16. %% @doc Lager's top level supervisor.
  17. %% @private
  18. -module(lager_sup).
  19. -behaviour(supervisor).
  20. %% API
  21. -export([start_link/0]).
  22. %% Callbacks
  23. -export([init/1]).
  24. start_link() ->
  25. supervisor:start_link({local, ?MODULE}, ?MODULE, []).
  26. init([]) ->
  27. Children = [
  28. {lager, {gen_event, start_link, [{local, lager_event}]},
  29. permanent, 5000, worker, [dynamic]},
  30. {lager_handler_watcher_sup, {lager_handler_watcher_sup, start_link, []},
  31. permanent, 5000, supervisor, [lager_handler_watcher_sup]}],
  32. %% check if the crash log is enabled
  33. Crash = case application:get_env(lager, crash_log) of
  34. {ok, File} ->
  35. [{lager_crash_log, {lager_crash_log, start_link, [File]},
  36. permanent, 5000, worker, [lager_crash_log]}];
  37. _ ->
  38. []
  39. end,
  40. {ok, {{one_for_one, 1000, 3600},
  41. Children ++ Crash
  42. }}.