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
=====
- gatherer.erl:29 Error on ++.
- Limit number of emails that can be sent in a period of time.
- gen_fsm for gatherer?

View File

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

View File

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