log_monitor/apps/log_monitor/src/log_monitor_sup.erl

61 lines
2.0 KiB
Erlang

%%%-------------------------------------------------------------------
%%% @author Fabio Salvini <fs@fabiosalvini.com>
%%% @copyright (C) 2017, Fabio Salvini
%% @doc log_monitor top level supervisor.
%% @end
%%% Created : 2 Jul 2017 by Fabio Salvini <fs@fabiosalvini.com>
%%%-------------------------------------------------------------------
-module(log_monitor_sup).
-behaviour(supervisor).
%% API
-export([start_link/0]).
%% Supervisor callbacks
-export([init/1]).
-define(SERVER, ?MODULE).
%%====================================================================
%% API functions
%%====================================================================
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
%%====================================================================
%% Supervisor callbacks
%%====================================================================
%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
init([]) ->
SupFlags = #{strategy => one_for_one},
ChildSpecs = [#{
id => mailer,
start => {mailer, start_link, []},
restart => permanent,
shutdown => 5000,
modules => [mailer]
},
#{
id => logfiles_sup,
start => {logfiles_sup, start_link, []},
restart => permanent,
type => supervisor,
shutdown => 5000,
modules => [logfiles_sup]
},
#{
id => config,
start => {config, start_link, []},
restart => permanent,
shutdown => 5000,
modules => [config]
}
],
{ok, {SupFlags, ChildSpecs}}.
%%====================================================================
%% Internal functions
%%====================================================================