Go to the source code of this file.
Defines |
|
#define | LOG_INFO 0 |
#define | LOG_WARNING 1 |
#define | LOG_ERR 2 |
#define | LOG_CRIT 3 |
Enumerations |
|
enum |
log_context { context_none = 0, context_threads = 1, context_socket = 2, context_server = 3, context_query = 4, context_conf = 5, context_zonedata = 6, context_system = 7 } |
logging contexts More... |
|
enum | log_severity { log_info = LOG_INFO, log_warning = LOG_WARNING, log_error = LOG_ERR, log_panic = LOG_CRIT } |
logging severity More... |
|
Variables |
|
const char | log_contexts [][16] |
void(* | pos_log )(log_context context, log_severity severity, char *log_fmt,...) |
pointer to logging function |
|
FILE * | outfile |
pointer to log file |
|
void(* | pos_log_fptr )(log_context context, log_severity severity, char *message) |
pointer to additional logging function |
|
bool | do_stderr_log |
whether we should log to stdout |
This file provices access to the Poslib logging mechanism. Poslib server functions use these logging functions internally. You can use the logging system as well, or you can provide your own logging function pointer so that that function will be called by the Poslib functions.
If you want to use the default Poslib logging mechanism, you need to #define POS_DEFAULTLOG before #include-ing poslib/server/server.h in exactly one source file (then, the code for the logging function is loaded). By default though, this logging system will do nothing. For each target you want to enable, #define one or more of the following:
pos_log_fptr
function pointer. This function should be of the type:
If you don't want to use the default mechanism, set the pos_log function pointer to your own custom logging function.
Definition in file log.h.
|
logging contexts For each log message, a loging context is passed through to indicate where the error happened. |
|
logging severity This indicates the severity of the log message. |
|
whether we should log to stdout If set to true (the default), the default logging functionality will log its messages to standard output. You ought to disable this if your server is doing a fork(). To use this, you'll need to define POS_DEFAULTLOG and POS_DEFAULTLOG_STDOUT. |
|
Array containing string descriptions for the various logging context. Can be used for custom logging functions. |
|
pointer to log file If the default logging functionality is used, this is the pointer to the file Poslib will log to. You need to take care of opening this file yourself (or leave it to NULL if you don't want it (yet)); closing the file when your server closes is done by Poslib. To use this, you'll need to define POS_DEFAULTLOG and POS_DEFAULTLOG_FILE. |
|
pointer to logging function This is a pointer to the logging function used by Poslib. The function it points to by default does nothing. Use the |
|
pointer to additional logging function If the default logging functionality is used, this is a function pointer to a custrom logging function that will be called by pos_log. This implies the function should be thread-safe. Set to NULL by default. To use this, you'll need to define POS_DEFAULTLOG and POS_DEFAULTLOG_FPTR. |