-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipc_user_macros.h
22 lines (15 loc) · 990 Bytes
/
ipc_user_macros.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// #define DEBUG_ENABLED
#ifdef DEBUG_ENABLED
#define _DEBUG(...) do{ fprintf(stderr, "\x1b[30;1m[ DEBUG ][ pid %d ] ", getpid()); fprintf( stderr, __VA_ARGS__ ); fprintf(stderr, "\x1b[0m\n");} while( 0 )
#define _ERR(...) do{ fprintf(stderr, "\x1b[31;1m[ ERR ][ pid %d ] ", getpid()); fprintf( stderr, __VA_ARGS__ ); fprintf(stderr, "\x1b[0m\n");} while( 0 )
#define _WARN(...) do{ fprintf(stderr, "\x1b[33;1m[ WARN ][ pid %d ] ", getpid()); fprintf( stderr, __VA_ARGS__ ); fprintf(stderr, "\x1b[0m\n");} while( 0 )
#else
#define _DEBUG(...) do{ } while ( 0 )
#define _ERR(...) do{ } while ( 0 )
#define _WARN(...) do{ } while ( 0 )
#endif
#define DEBUG(...) do{ _DEBUG( __VA_ARGS__ );} while( 0 )
#define ERR(...) do{ _ERR( __VA_ARGS__ );} while( 0 )
#define WARN(...) do{ _WARN( __VA_ARGS__ );} while( 0 )
#define TEST_BEGIN(...) do{ printf( "[ TEST_BEGIN ] "); printf( __VA_ARGS__ ); printf("\n");} while( 0 )
#define TEST_END(...) do{ printf( "[ TEST_END ]\n\n"); } while( 0 )