SYNOPSIS

#include <log4c/defs.h>

#include <log4c/layout.h>

#include <stdio.h>

Data Structures

struct log4c_appender_type

log4c appender type class

Defines

#define log4c_appender_type_define(a_type)

Typedefs

typedef struct __log4c_appender log4c_appender_t

typedef struct log4c_appender_type log4c_appender_type_t

log4c appender type class

Functions

LOG4C_API const log4c_appender_type_t * log4c_appender_type_get (const char *a_name)

LOG4C_API const log4c_appender_type_t * log4c_appender_type_set (const log4c_appender_type_t *a_type)

LOG4C_API log4c_appender_t * log4c_appender_get (const char *a_name)

LOG4C_API log4c_appender_t * log4c_appender_new (const char *a_name)

LOG4C_API void log4c_appender_delete (log4c_appender_t *a_appender)

LOG4C_API const char * log4c_appender_get_name (const log4c_appender_t *a_appender)

LOG4C_API const log4c_appender_type_t * log4c_appender_get_type (const log4c_appender_t *a_appender)

LOG4C_API const log4c_layout_t * log4c_appender_get_layout (const log4c_appender_t *a_appender)

LOG4C_API void * log4c_appender_get_udata (const log4c_appender_t *a_appender)

LOG4C_API const log4c_appender_type_t * log4c_appender_set_type (log4c_appender_t *a_appender, const log4c_appender_type_t *a_type)

LOG4C_API void * log4c_appender_set_udata (log4c_appender_t *a_appender, void *a_udata)

LOG4C_API const log4c_layout_t * log4c_appender_set_layout (log4c_appender_t *a_appender, const log4c_layout_t *a_layout)

LOG4C_API int log4c_appender_open (log4c_appender_t *a_appender)

LOG4C_API int log4c_appender_append (log4c_appender_t *a_appender, log4c_logging_event_t *a_event)

LOG4C_API int log4c_appender_close (log4c_appender_t *a_appender)

LOG4C_API void log4c_appender_print (const log4c_appender_t *a_appender, FILE *a_stream)

LOG4C_API void log4c_appender_types_print (FILE *fp)

Detailed Description

Implement this interface for your own strategies for printing log statements.

Todo

the appender interface needs a better configuration system depending on the layout type. The udata field is a just a trick.

Define Documentation

#define log4c_appender_type_define(a_type) Helper macro to define static appender types.

Parameters:

a_type the log4c_appender_type_t object to define

Warning:

needs GCC support: otherwise this macro does nothing

Deprecated

This macro, and the static initialialization of appenders in general, is deprecated. Use rather the log4c_appender_type_set() function to initialize your appenders before calling log4c_init()

Typedef Documentation

typedef struct __log4c_appender \fBlog4c_appender_t\fP log4c appender class

typedef struct \fBlog4c_appender_type\fP \fBlog4c_appender_type_t\fP

log4c appender type class Attributes description:

  • name appender type name

  • open

  • append

  • close

Function Documentation

LOG4C_API int log4c_appender_append (\fBlog4c_appender_t\fP *this, \fBlog4c_logging_event_t\fP *a_event) log in appender specific way.

Parameters:

a_appender the log4c_appender object

a_event the log4c_logging_event_t object to log.

Bug

is this the right place to open an appender ?

LOG4C_API int log4c_appender_close (\fBlog4c_appender_t\fP *a_appender) closes the appender

Parameters:

a_appender the log4c_appender_t object

Returns:

zero if successful, -1 otherwise

LOG4C_API void log4c_appender_delete (\fBlog4c_appender_t\fP *a_appender) Destructor for log4c_appender_t.

LOG4C_API \fBlog4c_appender_t\fP* log4c_appender_get (const char *a_name) Get a pointer to an existing appender.

Parameters:

a_name the name of the appender to return.

Returns:

a pointer to an existing appender, or NULL if no appender with the specfied name exists.

LOG4C_API const \fBlog4c_layout_t\fP* log4c_appender_get_layout (const \fBlog4c_appender_t\fP *a_appender) \fBParameters:\fP

a_appender the log4c_appender_t object

Returns:

the appender layout

LOG4C_API const char* log4c_appender_get_name (const \fBlog4c_appender_t\fP *a_appender) \fBParameters:\fP

a_appender the log4c_appender_t object

Returns:

the appender name

LOG4C_API const \fBlog4c_appender_type_t\fP* log4c_appender_get_type (const \fBlog4c_appender_t\fP *a_appender) \fBParameters:\fP

a_appender the log4c_appender_t object

Returns:

the appender operations

LOG4C_API void* log4c_appender_get_udata (const \fBlog4c_appender_t\fP *a_appender) \fBParameters:\fP

a_appender the log4c_appender_t object

Returns:

the appender user data

LOG4C_API \fBlog4c_appender_t\fP* log4c_appender_new (const char *a_name) Constructor for log4c_appender_t.

LOG4C_API int log4c_appender_open (\fBlog4c_appender_t\fP *a_appender) opens the appender.

Parameters:

a_appender the log4c_appender_t object

LOG4C_API void log4c_appender_print (const \fBlog4c_appender_t\fP *a_appender, FILE *a_stream) prints the appender on a stream

Parameters:

a_appender the log4c_appender_t object

a_stream the stream

LOG4C_API const \fBlog4c_layout_t\fP* log4c_appender_set_layout (\fBlog4c_appender_t\fP *a_appender, const \fBlog4c_layout_t\fP *a_layout) sets the appender layout

Parameters:

a_appender the log4c_appender_t object

a_layout the new appender layout

Returns:

the previous appender layout

LOG4C_API const \fBlog4c_appender_type_t\fP* log4c_appender_set_type (\fBlog4c_appender_t\fP *a_appender, const \fBlog4c_appender_type_t\fP *a_type) sets the appender type

Parameters:

a_appender the log4c_appender_t object

a_type the new appender type

Returns:

the previous appender type

LOG4C_API void* log4c_appender_set_udata (\fBlog4c_appender_t\fP *a_appender, void *a_udata) sets the appender user data

Parameters:

a_appender the log4c_appender_t object

a_udata the new appender user data

Returns:

the previous appender user data

LOG4C_API const \fBlog4c_appender_type_t\fP* log4c_appender_type_get (const char *a_name) Get a pointer to an existing appender type.

Parameters:

a_name the name of the appender type to return.

Returns:

a pointer to an existing appender type, or NULL if no appender type with the specified name exists.

LOG4C_API const \fBlog4c_appender_type_t\fP* log4c_appender_type_set (const \fBlog4c_appender_type_t\fP *a_type) Use this function to register an appender type with log4c. Once this is done you may refer to this type by name both programmatically and in the log4c configuration file.

Parameters:

a_type a pointer to the new appender type to set.

Returns:

a pointer to the previous appender type of same name.

Example code fragment:

 const log4c_appender_type_t log4c_appender_type_s13_file = {
   's13_file',
   s13_file_open,
   s13_file_append,
   s13_file_close,
 };

  log4c_appender_type_set(&log4c_appender_type_s13_file);

LOG4C_API void log4c_appender_types_print (FILE *fp) prints all the current registered appender types on a stream

Parameters:

fp the stream

Author

Generated automatically by Doxygen for log4c from the source code.