]> git.evergreen-ils.org Git - OpenSRF.git/blob - include/opensrf/log.h
Eliminated four dead functions that are never called
[OpenSRF.git] / include / opensrf / log.h
1 #include <opensrf/utils.h>
2
3 #include <syslog.h>
4 #include <stdio.h>
5 #include <time.h>
6 #include <errno.h>
7
8 #ifndef OSRF_LOG_INCLUDED
9 #define OSRF_LOG_INCLUDED
10
11 /* log levels */
12 #define OSRF_LOG_ERROR 1
13 #define OSRF_LOG_WARNING 2
14 #define OSRF_LOG_INFO 3
15 #define OSRF_LOG_DEBUG 4
16 #define OSRF_LOG_INTERNAL 5
17 #define OSRF_LOG_ACTIVITY -1
18
19 #define OSRF_LOG_TYPE_FILE 1
20 #define OSRF_LOG_TYPE_SYSLOG 2
21 #define OSRF_LOG_TYPE_STDERR 3
22
23 #define OSRF_LOG_MARK __FILE__, __LINE__
24
25
26 /* Initializes the logger. */
27 void osrfLogInit( int type, const char* appname, int maxlevel );
28
29 /** Sets the systlog facility for the regular logs */
30 void osrfLogSetSyslogFacility( int facility );
31
32 /** Sets the systlog facility for the activity logs */
33 void osrfLogSetSyslogActFacility( int facility );
34
35 /** Reroutes logged messages to standard error; */
36 /** intended for development and debugging */
37 void osrfLogToStderr( void );
38
39 /** Undoes the effects of osrfLogToStderr() */
40 void osrfRestoreLogType( void );
41
42 /** Sets the log file to use if we're logging to a file */
43 void osrfLogSetFile( const char* logfile );
44
45 /* once we know which application we're running, call this method to
46  * set the appname so log lines can include the app name */
47 void osrfLogSetAppname( const char* appname );
48
49 /** Set or Get the global log level.  Any log statements with a higher level
50  * than "level" will not be logged */
51 void osrfLogSetLevel( int loglevel );
52 int osrfLogGetLevel( void );
53
54 /* Log an error message */
55 void osrfLogError( const char* file, int line, const char* msg, ... );
56
57 /* Log a warning message */
58 void osrfLogWarning( const char* file, int line, const char* msg, ... );
59
60 /* log an info message */
61 void osrfLogInfo( const char* file, int line, const char* msg, ... );
62
63 /* Log a debug message */
64 void osrfLogDebug( const char* file, int line, const char* msg, ... );
65
66 /* Log an internal debug message */
67 void osrfLogInternal( const char* file, int line, const char* msg, ... );
68
69 /* Log an activity message */
70 void osrfLogActivity( const char* file, int line, const char* msg, ... );
71
72 void osrfLogCleanup( void );
73
74 void osrfLogClearXid( void );
75 /**
76  * Set the log XID.  This only sets the xid if we are not the origin client 
77  */
78 void osrfLogSetXid(char* xid);
79 /**
80  * Set the log XID regardless of whether we are the origin client
81  */
82 void osrfLogForceXid(char* xid);
83 void osrfLogMkXid( void );
84 void osrfLogSetIsClient(int is);
85 char* osrfLogGetXid( void );
86
87 /* sets the activity flag */
88 void osrfLogSetActivityEnabled( int enabled );
89
90 /* returns the int representation of the log facility based on the facility name
91  * if the facility name is invalid, LOG_LOCAL0 is returned 
92  */
93 int osrfLogFacilityToInt( char* facility );
94
95 #endif