diff --git a/apps/log_monitor/src/config.erl b/apps/log_monitor/src/config.erl index fdf64d3..490b30d 100644 --- a/apps/log_monitor/src/config.erl +++ b/apps/log_monitor/src/config.erl @@ -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]) ->