template<int N>
inline const char * CompileTimeGetFileName(const char(&arr)[N])
{
    //int size_ = N - 1;
    const char * filename = arr;
    const char* slash = strrchr(arr, '/');
    if (slash)
    {
        filename = slash + 1;
        //size_ -= static_cast<int>(data_ - arr);
    }
    return filename;
}

#define __FILENAME__ (CompileTimeGetFileName(__FILE__))
#define STAT_LOG(format, ...) log("STAT", __FILENAME__, __LINE__, format, ##__VA_ARGS__)
#define DBG_LOG(format,  ...) log("DEBUG", __FILENAME__, __LINE__, format, ##__VA_ARGS__)
#define ERR_LOG(format,  ...) log("ERROR", __FILENAME__, __LINE__, format, ##__VA_ARGS__)


备份地址: 【日志打印文件名