forked from smart2h/ssl-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simplog.h
44 lines (36 loc) · 1.29 KB
/
simplog.h
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
/*
A very basic logger for output of messages at various logging levels
with date/time stamp to standard out and a defined log file.
Author: Nate Peterson
Created: June 2013
Last Updated: Feb 2014
*/
#ifndef SIMPLOG_H
#define SIMPLOG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
// Define logging levels
#define SIMPLOG_FATAL -2 // A fatal error has occured: program will exit immediately
#define SIMPLOG_ERROR -1 // An error has occured: program may not exit
#define SIMPLOG_INFO 0 // Nessessary information regarding program operation
#define SIMPLOG_WARN 1 // Any circumstance that may not affect normal operation
#define SIMPLOG_DEBUG 2 // Standard debug messages
#define SIMPLOG_VERBOSE 3 // All debug messages
// Public functions
typedef struct {
void ( *const writeLog )( int loglvl, const char* str, ... );
void ( *const writeStackTrace )( void );
void ( *const setLogDebugLevel )( int level );
void ( *const setLogFile )( const char* file );
void ( *const setLogSilentMode )( bool silent );
void ( *const setLineWrap )( bool wrap );
void ( *const flushLog )( void );
void ( *const loadConfig )( const char* config );
} simplog_namespace;
extern simplog_namespace const simplog;
#ifdef __cplusplus
}
#endif
#endif