Log lines as list instead of binary

This commit is contained in:
Fabio Salvini 2017-07-02 09:37:38 +02:00
parent 1e26998649
commit d5136c731c
3 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,5 @@
TODO TODO
===== =====
- gatherer.erl:29 Error on ++.
- Limit number of emails that can be sent in a period of time. - Limit number of emails that can be sent in a period of time.
- gen_fsm for gatherer? - gen_fsm for gatherer?

View File

@ -26,9 +26,9 @@ handle_info({log_line, Text}, [on, Log = #log{error_regex = ErrorRegex}, Error,
true -> true ->
timer:cancel(Timer), timer:cancel(Timer),
{ok, NewTimer} = timer:send_after(1000, {timeout}), {ok, NewTimer} = timer:send_after(1000, {timeout}),
{noreply, [on, Log, Error ++ "\n" ++ Text, NewTimer, SafeTimer]}; {noreply, [on, Log, Error ++ Text, NewTimer, SafeTimer]};
false -> false ->
{noreply, [on, Log, Error ++ "\n" ++ Text, Timer, SafeTimer]} {noreply, [on, Log, Error ++ Text, Timer, SafeTimer]}
end; end;
handle_info({timeout}, [on, Log = #log{file = File}, Error, Timer, SafeTimer]) -> handle_info({timeout}, [on, Log = #log{file = File}, Error, Timer, SafeTimer]) ->
timer:cancel(Timer), timer:cancel(Timer),

View File

@ -19,7 +19,7 @@ handle_info(Msg, [File, SupPid, Port]) ->
case Msg of case Msg of
{Port, {data, Text}} -> {Port, {data, Text}} ->
GathererPid = gatherer_pid(SupPid), GathererPid = gatherer_pid(SupPid),
GathererPid ! {log_line, Text}, GathererPid ! {log_line, binary_to_list(Text)},
{noreply, [File, SupPid, Port]}; {noreply, [File, SupPid, Port]};
{Port, {exit_status, _Status}} -> {Port, {exit_status, _Status}} ->
{stop, tail_exit, [File]} {stop, tail_exit, [File]}