Restart log files monitoring on boot
This commit is contained in:
parent
bbf2a4ff54
commit
9a6464aa31
|
@ -13,9 +13,12 @@ start_link() ->
|
|||
init([]) ->
|
||||
register(config, self()),
|
||||
{ok, Storage} = application:get_env(log_monitor, storage),
|
||||
{ok, Logfiles} = dets:open_file(Storage, []),
|
||||
{ok, Logfiles} = dets:open_file(Storage, [{auto_save, 1000}]),
|
||||
Statuses = ets:new(log_statuses, []),
|
||||
%% TODO: start logs inside Logfile
|
||||
lists:foreach(fun({File, ErrorRegex}) ->
|
||||
ets:insert(Statuses, {File, disabled}),
|
||||
logfiles_sup:add_child([File, ErrorRegex])
|
||||
end, dets:foldl(fun(X, L) -> [X|L] end, [], Logfiles)),
|
||||
{ok, [Logfiles, Statuses]}.
|
||||
|
||||
handle_info({watcher_init, File}, State = [_Logfiles, Statuses]) ->
|
||||
|
|
Loading…
Reference in New Issue
Block a user