summaryrefslogtreecommitdiff
path: root/src/log.h
blob: f6c05340ebcb5f691794def80767c6cd5f67a0b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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