Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright 2008 Google Inc. All Rights Reserved.
      3  *
      4  * Author: md (at) google.com (Michael Davidson)
      5  */
      6 
      7 #ifndef LOGGING_H_
      8 #define LOGGING_H_
      9 
     10 enum msg_type {
     11 	MSG_DEBUG,
     12 	MSG_INFO,
     13 	MSG_WARN,
     14 	MSG_ERROR,
     15 	MSG_FATAL,
     16 };
     17 
     18 void msg(enum msg_type, int data, const char *fmt, ...);
     19 
     20 #define	DEBUG(level, fmt, args...)	msg(MSG_DEBUG, level, fmt, ##args)
     21 #define	INFO(fmt, args...)		msg(MSG_INFO, 0, fmt, ##args)
     22 #define	WARN(err, fmt, args...)		msg(MSG_WARN, err, fmt, ##args)
     23 #define	ERROR(err, fmt, args...)	msg(MSG_ERROR, err, fmt, ##args)
     24 #define	FATAL(err, fmt, args...)	msg(MSG_FATAL, err, fmt, ##args)
     25 
     26 extern void set_program_name(const char *name);
     27 extern void set_debug_level(int level);
     28 extern void set_log_file(FILE *fp);
     29 
     30 #endif /* LOGGING_H_ */
     31