show basename for easier trace log reader
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1174 c26eb9a1-5813-0410-bd6c-c2e55f420ca73.0
parent
8b83b80664
commit
7cd9b79490
|
@ -1,7 +1,15 @@
|
|||
#include "php.h"
|
||||
#include "xc_trace.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
const char *xc_trace_get_basename(const char *path) /* {{{ */
|
||||
{
|
||||
const char *last_separator = strrchr(path, PHP_DIR_SEPARATOR);
|
||||
return last_separator ? last_separator + 1 : path;
|
||||
}
|
||||
/* }}} */
|
||||
int xc_vtrace(const char *fmt, va_list args) /* {{{ */
|
||||
{
|
||||
return vfprintf(stderr, fmt, args);
|
||||
|
|
|
@ -32,8 +32,9 @@ static inline int TRACE(const char *fmt, ...)
|
|||
return ret;
|
||||
}
|
||||
# else
|
||||
const char *xc_trace_get_basename(const char *path);
|
||||
# define TRACE(fmt, ...) \
|
||||
xc_trace("%s:%d: " fmt "\r\n", __FILE__, __LINE__, __VA_ARGS__)
|
||||
xc_trace("%s:%d: " fmt "\r\n", xc_trace_get_basename(__FILE__), __LINE__, __VA_ARGS__)
|
||||
# endif /* ZEND_WIN32 */
|
||||
# undef NDEBUG
|
||||
# undef inline
|
||||
|
|
Loading…
Reference in New Issue