summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2012-11-13 12:30:21 +0000
committerXuefer <xuefer@gmail.com>2012-11-13 12:30:21 +0000
commit7cd9b7949011951f7efa45ffc0ed969d90d38aaf (patch)
treea1c2fa7b294694d903dbd075102471988140f32a /util
parent8b83b806646167be0b84b4e097fc872dc8b90c79 (diff)
downloadxcache-7cd9b7949011951f7efa45ffc0ed969d90d38aaf.tar.gz
xcache-7cd9b7949011951f7efa45ffc0ed969d90d38aaf.zip
show basename for easier trace log reader
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1174 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'util')
-rw-r--r--util/xc_trace.c8
-rw-r--r--util/xc_trace.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/util/xc_trace.c b/util/xc_trace.c
index 09105d2..9550f13 100644
--- a/util/xc_trace.c
+++ b/util/xc_trace.c
@@ -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);
diff --git a/util/xc_trace.h b/util/xc_trace.h
index cd8774f..8bc4305 100644
--- a/util/xc_trace.h
+++ b/util/xc_trace.h
@@ -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