Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

logger.h File Reference

PDepp's logger module. More...

#include "common.h"
#include <varargs.h>

Include dependency graph for logger.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define PDEPP_CORE   0
 log message issued by daemon.

#define QUERY_HANDLER   1
 log message issued by the client manager.

#define LOGGER   2
 log message issued by the logger itself.

#define CONF_TABLE   3
 log message issued by the configuration table manager.

#define CONN_HANDLER   4
 log msg. issued by a connection handler.

#define PROT_HANDLER   5
 log message issued by a protocol handler.

#define REQUEST_HANDLER   6
 log message issued by a request handler.

#define MIME_TABLE   7
 MIME-type related log message.

#define LOG_SRC_LAST   MIME_TABLE
 "pointer" to the last logging source defined.

#define LOG_SRC_PLACEHOLDER_ALL   "A"
 this one stands for "select all msg sources".

#define DEBUG   0
 debug messages.

#define LOG_KEY_DEBUG   "d"
 log file key.

#define INFO   1
 informational messages.

#define LOG_KEY_INFO   "i"
 log file key.

#define NOTICE   2
 important informational messages.

#define LOG_KEY_NOTICE   "n"
 log file key.

#define WARNING   3
 non critical warnings.

#define LOG_KEY_WARNING   "w"
 log file key.

#define ERROR   4
 errors.

#define LOG_KEY_ERROR   "e"
 log file key.

#define CRITICAL   5
 critical errors (server aborting).

#define LOG_KEY_CRITICAL   "c"
 log file key.

#define LOG_LVL_LAST   CRITICAL
 "pointer" to the highest sev. level defined.

#define LOG_LVL_PLACEHOLDER_ALL   "a"
 this one stands for "select all severity levels".

#define LOG_NULL_STREAM   "no"
 name of the "null" logging stream.

#define LOG_NULL_FORMAT   "off"
 format string to give to switch logging of.

#define LOG_PANIC_FORMAT   "%h:%m:%s> %S: %L\\n"
 std. format for stderr.

#define MP   '%'
 the format char for symbols.

#define MP_YEAR   'Y'
 the format abbreviation for "year".

#define MP_MONTH   'M'
 the format abbreviation for "month".

#define MP_DAY   'D'
 the format abbreviation for "day".

#define MP_WDAY   'w'
 the format abbreviation for "day of week (short)".

#define MP_WDAYL   'W'
 the format abbreviation for "day of week (long)".

#define MP_HOUR   'h'
 the format abbreviation for "hour".

#define MP_MIN   'm'
 the format abbreviation for "minute".

#define MP_SEC   's'
 the format abbreviation for "second".

#define MP_SRC   'S'
 the format abbreviation for "source".

#define MP_LOG   'L'
 the format abbreviation for "log content".

#define WD_SHORT   0
 for short day_of_week.

#define WD_LONG   1
 for long day_of_week.


Typedefs

typedef Logger * Logger
 a convenience name for a Logger object.


Functions

Logger logInit (const char *file_name, const char *format)
 opens a new logfile. returns 0 an success. More...

Logger logInitStream (FILE *log_stream, const char *format)
 sets the current logging stream to use the given stream log_stream. More...

int logMessagev (Logger this, const unsigned int origin, const unsigned int severity, const int errno_val, const char *const log_text_format, va_list daten)
 Low level function to write a message into on specific Logger object. May well become an internal function in the near future.

int logTerminate (Logger this)
 terminates a Logger object. More...

int logfilesInit ()
 initialises the logging subsystem. More...

int logerr (const unsigned int source, const unsigned int severity, const int errno_val, const char *const log_text_format,...)
 writes an error message with error code description. More...

int logger (const unsigned int origin, const unsigned int severity, const char *const log_text,...)
 writes a generic logging message. More...

int logfilesTerminate ()
 shuts down the logging subsystem. More...


Detailed Description

PDepp's logger module.

Definition in file logger.h.


Function Documentation

Logger logInit const char *    file_name,
const char *    format
 

opens a new logfile. returns 0 an success.

Configures the logger to use file_name as the default logging output stream.

Parameters:
file_name  Name of a file system entity that can be opened as a stream.
Returns:
Returns a valid logger object on success and NULL on failure.

Logger logInitStream FILE *    log_stream,
const char *    format
 

sets the current logging stream to use the given stream log_stream.

Configures logger to use log_stream as its default output stream.

Parameters:
log_stream  a valid output stream
Returns:
Returns a valid Logger object on success and NULL on failure.

Referenced by logfilesInit().

int logTerminate Logger    this
 

terminates a Logger object.

Parameters:
this  a Logger object
The Logger object this destroyed and all ressources allocated by it are freed. The logging stream itself is only freed if it has been opened by logInit(). If the Logger object has been created using logInitStream() the stream is not changed by this function.

Returns:
0 on success, -1 on failure

Referenced by logfilesInit(), and logfilesTerminate().

int logerr const unsigned int    source,
const unsigned int    severity,
const int    errno_val,
const char *const    log_text_format,
...   
 

writes an error message with error code description.

Parameters:
source  a valid log message source macro as defined in logger.h
severity  a valid severity level macro as defined in logger.h
errno_val  an errno error value returned by a libc function
log_text_format  a "printf()"-style format string containing the log message
...  additional informational parameters as described by the format string
The log message is written to all logging streams configured with logfilesInit(), formattet according to log_text_format and the format assigned to the logging stream used.

Returns:
0 on success, -1 on failure

Referenced by chInit(), chReceive(), chSend(), copyRequestLine(), initServer(), main(), mimeInit(), readConfigFile(), rhfInit(), rhfSend(), and svMain().

int logfilesInit  
 

initialises the logging subsystem.

logfilesInit() initialises the log message subsystem, using all configured logfiles if the configuration data is already read or stderr as the default output stream.

Returns:
Returns 0 on success and -1 on failure. If -1 is returned something got seriously wrong, the logging subsystem is NOT operational and NO messages MUST be logged!

int logfilesTerminate  
 

shuts down the logging subsystem.

Frees all ressources allocated by the logging system and closes all logging streams. Do not use logger or logerr after calling this function!

Returns:
0 on success, -1 on failure

int logger const unsigned int    origin,
const unsigned int    severity,
const char *const    log_text,
...   
 

writes a generic logging message.

Parameters:
source  a valid log message source macro as defined in logger.h
severity  a valid severity level macro as defined in logger.h
log_text_format  a "printf()"-style format string containing the log message
...  additional informational parameters as described by the format string
The log message is written to all logging streams configured with logfilesInit(), formattet according to log_text_format and the format assigned to the logging stream used.

Returns:
0 on success, -1 on failure

Referenced by chInit(), chReceive(), chSend(), chTerminate(), changeUserGroupID(), main(), strToTimet(), svCloseConnection(), and svMain().


Generated on Fri Jan 25 22:40:51 2002 for PDepp Webserver by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001