WIN:
1
#define
LOG( format, ... ) \
2 do { \
3 fprintf( stderr, format, ##__VA_ARGS__ ); \
4 } while ( 0 )
5
6 LOG( " hEIHEI, %s %d\n " , " sdfs " , 333 ); // -> hEIHEI, sdfs 333
7
8 #define XLOG( format, ... ) \
9 do { \
10 fprintf( stderr, " [%s@%s,%d] " format " \n " , __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__ ); \ \
11 } while ( 0 )
12
13 XLOG( " SDF %d " , 45 ); // -> Test@Test.cpp, 125 SDF 45
2 do { \
3 fprintf( stderr, format, ##__VA_ARGS__ ); \
4 } while ( 0 )
5
6 LOG( " hEIHEI, %s %d\n " , " sdfs " , 333 ); // -> hEIHEI, sdfs 333
7
8 #define XLOG( format, ... ) \
9 do { \
10 fprintf( stderr, " [%s@%s,%d] " format " \n " , __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__ ); \ \
11 } while ( 0 )
12
13 XLOG( " SDF %d " , 45 ); // -> Test@Test.cpp, 125 SDF 45
Unicode:
#define ULOG( foramt, ... )
do{
fprintf( stderr, L"" format L"\n", _T(__FUNCTION__), _T(__FILE__), __LINE__, ##__VA_ARGS__);
}while(0)
ULOG( L"HEIHEI %d", 333);
LINUX:
#define
LOG( format, args... ) \
do { \
fprintf( stderr, " [%s@%s,%d] " format " \n " , __FUNC__, __FILE__, __LINE__, ##args ); \
} while ( 0 )
do { \
fprintf( stderr, " [%s@%s,%d] " format " \n " , __FUNC__, __FILE__, __LINE__, ##args ); \
} while ( 0 )