Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

poslib/server/log.h File Reference

Poslib server logging mechanism. More...

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


Detailed Description

Poslib server logging mechanism.

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:

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.


Enumeration Type Documentation

enum log_context
 

logging contexts

For each log message, a loging context is passed through to indicate where the error happened.

Enumeration values:
context_none  nothing particular
context_threads  threads system
context_socket  socket error
context_server  server error
context_query  query error
context_conf  configuration
context_zonedata  zone data
context_system  system error

Definition at line 81 of file log.h.

enum log_severity
 

logging severity

This indicates the severity of the log message.

Enumeration values:
log_info  informational
log_warning  warning
log_error  error
log_panic  critical error

Definition at line 97 of file log.h.


Variable Documentation

bool do_stderr_log
 

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.

Definition at line 247 of file log.h.

const char log_contexts[][16]
 

Array containing string descriptions for the various logging context. Can be used for custom logging functions.

Definition at line 110 of file log.h.

FILE* outfile
 

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.

Definition at line 227 of file log.h.

void(* pos_log)(log_context context, log_severity severity, char *log_fmt,...)
 

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 POS_DEFAULTLOG #define (more info in the log.h file documentation) to use the standard logging functionality.

Definition at line 125 of file log.h.

void(* pos_log_fptr)(log_context context, log_severity severity, char *message)
 

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.

Definition at line 237 of file log.h.


Generated on Fri Dec 24 19:55:15 2004 for Poslib by doxygen 1.3.7