Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define SA_LOG( fmt, ... )\
- {\
- FILE* fp = fopen( "salog.log", "a" );\
- struct timeval tv;\
- memset( &tv, 0, sizeof(struct timeval) );\
- gettimeofday( &tv, NULL );\
- char* ct = ctime( &(tv.tv_sec) );\
- size_t ctl = strlen( ct );\
- ct[ (ctl>=6 ? ctl-6 : 0) ] = 0x00;\
- fprintf( fp,\
- "%s.%06ld %s:%d || %s: " fmt "\n",\
- ct+8, tv.tv_usec,\
- ( rindex(__FILE__, '/') ? rindex(__FILE__, '/') : __FILE__ ) ,\
- __LINE__, __PRETTY_FUNCTION__,\
- ##__VA_ARGS__ );\
- fclose( fp );\
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement