7 #ifndef OSRF_LOG_INCLUDED
8 #define OSRF_LOG_INCLUDED
11 #define OSRF_LOG_ERROR 1
12 #define OSRF_LOG_WARNING 2
13 #define OSRF_LOG_INFO 3
14 #define OSRF_LOG_DEBUG 4
15 #define OSRF_LOG_INTERNAL 5
16 #define OSRF_LOG_ACTIVITY -1
18 #define OSRF_LOG_TYPE_FILE 1
19 #define OSRF_LOG_TYPE_SYSLOG 2
21 #define OSRF_LOG_MARK __FILE__, __LINE__
24 /* Initializes the logger. */
25 void osrfLogInit( int type, const char* appname, int maxlevel );
27 /** Sets the systlog facility for the regular logs */
28 void osrfLogSetSyslogFacility( int facility );
30 /** Sets the systlog facility for the activity logs */
31 void osrfLogSetSyslogActFacility( int facility );
33 /** Sets the log file to use if we're logging to a file */
34 void osrfLogSetFile( const char* logfile );
36 /* once we know which application we're running, call this method to
37 * set the appname so log lines can include the app name */
38 void osrfLogSetAppname( const char* appname );
40 /** Set or Get the global log level. Any log statements with a higher level
41 * than "level" will not be logged */
42 void osrfLogSetLevel( int loglevel );
43 int osrfLogGetLevel( void );
45 /* Log an error message */
46 void osrfLogError( const char* file, int line, const char* msg, ... );
48 /* Log a warning message */
49 void osrfLogWarning( const char* file, int line, const char* msg, ... );
51 /* log an info message */
52 void osrfLogInfo( const char* file, int line, const char* msg, ... );
54 /* Log a debug message */
55 void osrfLogDebug( const char* file, int line, const char* msg, ... );
57 /* Log an internal debug message */
58 void osrfLogInternal( const char* file, int line, const char* msg, ... );
60 /* Log an activity message */
61 void osrfLogActivity( const char* file, int line, const char* msg, ... );
63 void osrfLogCleanup();
65 void osrfLogClearXid();
66 void osrfLogSetXid(char* xid);
68 void osrfLogSetIsClient(int is);
69 char* osrfLogGetXid();
71 /* sets the activity flag */
72 void osrfLogSetActivityEnabled( int enabled );
74 /* returns the int representation of the log facility based on the facility name
75 * if the facility name is invalid, LOG_LOCAL0 is returned
77 int osrfLogFacilityToInt( char* facility );