src/server/daemon/log.h

changeset 45
a24aa388f02f
parent 44
3da1f7b6847f
child 60
feb2f1e115c6
equal deleted inserted replaced
44:3da1f7b6847f 45:a24aa388f02f
30 #define LOG_H 30 #define LOG_H
31 31
32 #include "../public/nsapi.h" 32 #include "../public/nsapi.h"
33 #include "../ucx/string.h" 33 #include "../ucx/string.h"
34 34
35 #include <inttypes.h>
36
35 #ifdef __cplusplus 37 #ifdef __cplusplus
36 extern "C" { 38 extern "C" {
37 #endif 39 #endif
38 40
39 #define LOG_LEVEL_ERROR 0 41 #define LOG_LEVEL_ERROR 0
44 char *file; 46 char *file;
45 char *level; 47 char *level;
46 int log_stdout; 48 int log_stdout;
47 int log_stderr; 49 int log_stderr;
48 } LogConfig; 50 } LogConfig;
49 51
52 typedef struct {
53 sstr_t file;
54 sstr_t format; // unused
55 FILE *log;
56 uint32_t ref;
57 } AccessLog;
58
59 // server logging
50 int init_log_file(LogConfig *cfg); 60 int init_log_file(LogConfig *cfg);
51 61
52 void log_uninitialized_writeln(char *str, size_t len); 62 void log_uninitialized_writeln(char *str, size_t len);
53 63
54 void log_file_writeln(char *str, size_t len); 64 void log_file_writeln(char *str, size_t len);
55 65
56 sstr_t log_get_prefix(int level); 66 sstr_t log_get_prefix(int level);
57 67
58 int log_ereport(int degree, const char *format, ...); 68 int log_ereport(int degree, const char *format, ...);
59 69
70 // access logging
71 AccessLog* get_access_log(sstr_t file, sstr_t format);
72 AccessLog* get_default_access_log();
73
74 // TODO: ref/unref
60 75
61 #ifdef __cplusplus 76 #ifdef __cplusplus
62 } 77 }
63 #endif 78 #endif
64 79

mercurial