From 043faaeae418c54b7adf390e1a3ba1e89aae3ecf Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Mon, 8 Mar 2021 01:55:28 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20crashlog=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/crashLog/rumCrashLog.erl | 2 +- src/utils/rumUtil.erl | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/crashLog/rumCrashLog.erl b/src/crashLog/rumCrashLog.erl index b30da8b..68c6ae5 100644 --- a/src/crashLog/rumCrashLog.erl +++ b/src/crashLog/rumCrashLog.erl @@ -187,7 +187,7 @@ do_log({log, Event}, #state{fileName = Name, fd = FD, inode = Inode, ctime = Cti case Rotator:ensure_logfile(Name, FD, Inode, Ctime, false) of {ok, {_FD, _Inode, _Ctime, Size}} when RotSize /= 0, Size > RotSize -> _ = Rotator:rotate_logfile(Name, Count), - handle_cast({log, Event}, State); + handleCast({log, Event}, State); {ok, {NewFD, NewInode, NewCtime, _Size}} -> TimeBinStr = rumUtil:msToBinStr(), Time = [TimeBinStr, " =", ReportStr, "====\n"], diff --git a/src/utils/rumUtil.erl b/src/utils/rumUtil.erl index 2a98423..c94ba6d 100644 --- a/src/utils/rumUtil.erl +++ b/src/utils/rumUtil.erl @@ -479,23 +479,20 @@ is_loggable(Msg, SeverityThreshold, MyName) when is_integer(SeverityThreshold) - rumMsg:severity_as_int(Msg) =< SeverityThreshold orelse lists:member(MyName, rumMsg:destinations(Msg)). -%% When logRoot option is provided, get the real path to a file parsePath(RelPath) -> - RelPath2 = case rumUtil:get_env(logRoot, undefined) of - {ok, LogRoot} when is_list(LogRoot) -> % Join relative path - %% check if the given RelPath contains LogRoot, if so, do not add - %% it again; see gh #304 - case filename:dirname(RelPath) of - "." -> - filename:join(LogRoot, RelPath); - false -> - RelPath - end; - undefined -> % No logRoot given, keep relative path - RelPath - end, - %% see #534 make sure c:cd can't change file path, trans filename to abs name - filename:absname(RelPath2). + NewRelPath = + case rumUtil:get_env(logRoot, undefined) of + undefined -> + RelPath; + LogRoot -> + case filename:dirname(RelPath) of + "." -> + filename:join(LogRoot, RelPath); + false -> + RelPath + end + end, + filename:absname(NewRelPath). %% Find a file among the already installed handlers. %%