Fri, 20 Dec 2019 14:44:50 +0100
fixes logging of absolute paths in ucx_logger_logf()
src/logging.c | file | annotate | diff | comparison | revisions | |
src/ucx/logging.h | file | annotate | diff | comparison | revisions |
--- 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;
--- 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: * * <code>[LEVEL] [TIMESTAMP] [SOURCEFILE]:[LINENO] message</code> - * + * + * 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. + * * <b>Attention:</b> 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.