Statistics
| Branch: | Revision:

napa-baselibs / ml / ml_log.h @ 5f3adef4

History | View | Annotate | Download (849 Bytes)

1
#ifndef _ML_LOG_H
2
#define _ML_LOG_H
3

    
4
#include <stdlib.h>
5
#include <stdio.h>
6

    
7
//#include "grapes_log.h"
8

    
9
#ifndef _GRAPES_LOG_H
10

    
11
#define DPRINT(format, ... )  {struct timeval tnow; gettimeofday(&tnow,NULL); fprintf(stderr, "%ld.%03ld "format, tnow.tv_sec, tnow.tv_usec/1000, ##__VA_ARGS__ );}
12

    
13
#define debug(format, ... ) //DPRINT(format, ##__VA_ARGS__ )
14
/** Convenience macro to log LOG_INFO messages */
15
#define info(format, ... )  DPRINT(format, ##__VA_ARGS__ )
16
/** Convenience macro to log LOG_WARN messages */
17
#define warn(format, ... )  DPRINT(format, ##__VA_ARGS__ )
18
/** Convenience macro to log LOG_ERROR messages */
19
#define error(format, ... )  DPRINT(format, ##__VA_ARGS__ )
20
/**  Convenience macro to log LOG_CRITICAL messages and crash the program */
21
#define fatal(format, ... )  { DPRINT(format, ##__VA_ARGS__ ); exit(-1); }
22

    
23
#endif
24
#endif