Skip to content

Commit 59cff26

Browse files
committed
Make tlog show short path by default.
1 parent ea80fc9 commit 59cff26

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tlog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ int tlog_localtime(struct tlog_time *tm)
317317
return _tlog_gettime(tm);
318318
}
319319

320-
tlog_log *tlog_get_root()
320+
tlog_log *tlog_get_root(void)
321321
{
322322
return tlog.root;
323323
}

tlog.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ level: Current log Levels
7878
format: Log formats
7979
*/
8080
#ifndef BASE_FILE_NAME
81-
#define BASE_FILE_NAME __FILE__
81+
#define BASE_FILE_NAME \
82+
(__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 \
83+
: __FILE__)
8284
#endif
8385
#define tlog(level, format, ...) tlog_ext(level, BASE_FILE_NAME, __LINE__, __func__, NULL, format, ##__VA_ARGS__)
8486

0 commit comments

Comments
 (0)