Change filesync_repeat_interval to no_repeat

This commit is contained in:
terry-xiaoyu 2018-11-05 16:04:58 +08:00
parent f6266eaa93
commit cca27d1a5a
1 changed files with 13 additions and 10 deletions

View File

@ -464,27 +464,30 @@ end}.
#{level => TopLogLevel, #{level => TopLogLevel,
config => FileConf(cuttlefish:conf_get("log.file", Conf)), config => FileConf(cuttlefish:conf_get("log.file", Conf)),
formatter => Formatter, formatter => Formatter,
filesync_repeat_interval => 1000}}]; filesync_repeat_interval => no_repeat}}];
true -> [] true -> []
end, end,
%% For creating additional log files for specific log levels. %% For creating additional log files for specific log levels.
AdditionalLogFiles = AdditionalLogFiles =
if LogTo =:= file orelse LogTo =:= both -> lists:foldl(
lists:filter(fun({K, V}) -> fun({[_, Level, _] = K, Filename}, Acc) when LogTo =:= file; LogTo =:= both ->
cuttlefish_variable:is_fuzzy_match(K, string:tokens("log.$level.file", ".")) case cuttlefish_variable:is_fuzzy_match(K, ["log", "$level", "file"]) of
end, Conf); true -> [{Level, Filename} | Acc];
true -> [] false -> Acc
end, end;
({_K, _V}, Acc) ->
Acc
end, [], Conf),
AdditionalHandlers = AdditionalHandlers =
[{handler, list_to_atom("file_for_"++Level), logger_disk_log_h, [{handler, list_to_atom("file_for_"++Level), logger_disk_log_h,
#{level => list_to_atom(Level), #{level => list_to_atom(Level),
config => FileConf(Filename), config => FileConf(Filename),
formatter => Formatter, formatter => Formatter,
filesync_repeat_interval => 1000}} filesync_repeat_interval => no_repeat}}
|| {[_, Level, _], Filename} <- AdditionalLogFiles], || {Level, Filename} <- AdditionalLogFiles],
_AllHandlers = DefaultHandler ++ FileHandler ++ AdditionalHandlers DefaultHandler ++ FileHandler ++ AdditionalHandlers
end}. end}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------