fix: check if trace is enabled when the file is not found
This commit is contained in:
parent
683bec16a3
commit
2740c80b20
|
@ -145,6 +145,8 @@ stream_log_file(#{name := Name}, Params) ->
|
|||
{eof, Size} ->
|
||||
Meta = #{<<"position">> => Size, <<"bytes">> => Bytes},
|
||||
{ok, #{meta => Meta, items => <<"">>}};
|
||||
{error, trace_disabled} ->
|
||||
{error, io_lib:format("trace_disable_on_~s", [Node0])};
|
||||
{error, Reason} ->
|
||||
logger:log(error, "read_file_failed ~p", [{Node, Name, Reason, Position, Bytes}]),
|
||||
{error, Reason};
|
||||
|
@ -194,6 +196,11 @@ read_file(Path, Offset, Bytes) ->
|
|||
after
|
||||
file:close(IoDevice)
|
||||
end;
|
||||
{error, enoent} ->
|
||||
case emqx_trace:is_enable() of
|
||||
false -> {error, trace_disabled};
|
||||
true -> {error, enoent}
|
||||
end;
|
||||
{error, Reason} -> {error, Reason}
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue