# HG changeset patch # User Mike Becker # Date 1576849490 -3600 # Node ID 028039652b863e0367eac1a4da6c8d1d35e54972 # Parent 460c0258bb5b8a9bd51a76c175134e89f6c231ba fixes logging of absolute paths in ucx_logger_logf() diff -r 460c0258bb5b -r 028039652b86 src/logging.c --- a/src/logging.c Fri Dec 20 14:29:41 2019 +0100 +++ b/src/logging.c Fri Dec 20 14:44:50 2019 +0100 @@ -91,6 +91,10 @@ k += strftime(msg+k, 128, logger->dateformat, localtime(&now)); } if ((logger->mask & UCX_LOGGER_SOURCE) > 0) { + char *fpart = strrchr(file, '/'); + if (fpart) file = fpart+1; + fpart = strrchr(file, '\\'); + if (fpart) file = fpart+1; n = strlen(file); memcpy(msg+k, file, n); k += n; diff -r 460c0258bb5b -r 028039652b86 src/ucx/logging.h --- a/src/ucx/logging.h Fri Dec 20 14:29:41 2019 +0100 +++ b/src/ucx/logging.h Fri Dec 20 14:44:50 2019 +0100 @@ -160,7 +160,10 @@ * format is: * * [LEVEL] [TIMESTAMP] [SOURCEFILE]:[LINENO] message - * + * + * The source file name is reduced to the actual file name. This is necessary to + * get consistent behavior over different definitions of the __FILE__ macro. + * * Attention: the message (including automatically generated information) * is limited to 4096 characters. The level description is limited to * 256 characters and the timestamp string is limited to 128 characters.