summaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/log.h b/src/log.h
new file mode 100644
index 0000000..f6c0534
--- /dev/null
+++ b/src/log.h
@@ -0,0 +1,60 @@
+#ifndef __LOG_H
+#define __LOG_H
+
+#include "port/sys.h"
+
+#include <syslog.h> /* for syslog, closelog and levels */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if 0
+/* defined in syslog.h */
+#define LOG_EMERG 0 /* system is unusable */
+#define LOG_ALERT 1 /* action must be taken immediately */
+#define LOG_CRIT 2 /* critical conditions */
+#define LOG_ERR 3 /* error conditions */
+#define LOG_WARNING 4 /* warning conditions */
+#define LOG_NOTICE 5 /* normal but significant condition */
+#define LOG_INFO 6 /* informational */
+#define LOG_DEBUG 7 /* debug-level messages */
+#endif
+
+#define LOG_DEBUG1 ( LOG_DEBUG + 1 )
+#define LOG_DEBUG2 ( LOG_DEBUG + 2 )
+#define LOG_DEBUG3 ( LOG_DEBUG + 3 )
+#define LOG_DEBUG4 ( LOG_DEBUG + 4 )
+#define LOG_DEBUG5 ( LOG_DEBUG + 5 )
+
+const char *log_syslog_facility_to_str( int facility );
+
+int log_str_to_syslog_facility( const char *facility );
+
+const char *log_level_to_str( int level );
+
+int log_str_to_level( const char *level );
+
+void openlogtofile( const char *filename, int level );
+
+void openlogtosyslog( const char *ident, int facility, int level );
+
+void openlogtostderr( int level );
+
+void closelogtofile( void );
+
+void closelogtosyslog( void );
+
+void closelogtostderr( void );
+
+void reopenlogtofile( void );
+
+void reopenlogtosyslog( void );
+
+void LOG( int level, const char *format, ... );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif