Log4gAppender

Log4gAppender — The log output interface

Synopsis

                    Log4gAppender;
                    Log4gAppenderClass;
void                log4g_appender_clear_filters        (Log4gAppender *self);
void                log4g_appender_add_filter           (Log4gAppender *self,
                                                         Log4gFilter *filter);
Log4gFilter *       log4g_appender_get_filter           (Log4gAppender *self);
void                log4g_appender_close                (Log4gAppender *self);
void                log4g_appender_do_append            (Log4gAppender *self,
                                                         Log4gLoggingEvent *event);
const gchar *       log4g_appender_get_name             (Log4gAppender *self);
void                log4g_appender_set_error_handler    (Log4gAppender *self,
                                                         gpointer handler);
gpointer            log4g_appender_get_error_handler    (Log4gAppender *self);
void                log4g_appender_set_layout           (Log4gAppender *self,
                                                         Log4gLayout *layout);
Log4gLayout *       log4g_appender_get_layout           (Log4gAppender *self);
void                log4g_appender_set_name             (Log4gAppender *self,
                                                         const gchar *name);
gboolean            log4g_appender_requires_layout      (Log4gAppender *self);
void                log4g_appender_activate_options     (Log4gAppender *self);
void                log4g_appender_append               (Log4gAppender *self,
                                                         Log4gLoggingEvent *event);
Log4gFilter *       log4g_appender_get_first_filter     (Log4gAppender *self);
gboolean            log4g_appender_is_as_severe_as      (Log4gAppender *self,
                                                         Log4gLevel *level);
void                log4g_appender_set_threshold        (Log4gAppender *self,
                                                         const gchar *threshold);
Log4gLevel *        log4g_appender_get_threshold        (Log4gAppender *self);
gboolean            log4g_appender_get_closed           (Log4gAppender *self);
void                log4g_appender_set_closed           (Log4gAppender *self,
                                                         gboolean closed);
void                (*Log4gAppenderAddFilter)           (Log4gAppender *self,
                                                         Log4gFilter *filter);
Log4gFilter         (*Log4gAppenderGetFilter)           (Log4gAppender *self);
void                (*Log4gAppenderClose)               (Log4gAppender *self);
void                (*Log4gAppenderAppend)              (Log4gAppender *base,
                                                         Log4gLoggingEvent *event);
void                (*Log4gAppenderDoAppend)            (Log4gAppender *self,
                                                         Log4gLoggingEvent *event);
void                (*Log4gAppenderSetName)             (Log4gAppender *self,
                                                         const gchar *name);
const gchar         (*Log4gAppenderGetName)             (Log4gAppender *self);
void                (*Log4gAppenderSetErrorHandler)     (Log4gAppender *self,
                                                         gpointer handler);
gpointer            (*Log4gAppenderGetErrorHandler)     (Log4gAppender *self);
void                (*Log4gAppenderSetLayout)           (Log4gAppender *self,
                                                         Log4gLayout *layout);
Log4gLayout         (*Log4gAppenderGetLayout)           (Log4gAppender *self);
gboolean            (*Log4gAppenderRequiresLayout)      (Log4gAppender *self);
void                (*Log4gAppenderActivateOptions)     (Log4gAppender *self);

Description

Extend this class to define your own strategy for outputting log statements.

Details

Log4gAppender

typedef struct {
} Log4gAppender;

The Log4gAppender structure does not have any public members.


Log4gAppenderClass

typedef struct {
    Log4gAppenderAddFilter add_filter;
    Log4gAppenderGetFilter get_filter;
    Log4gAppenderClose close;
    Log4gAppenderAppend append;
    Log4gAppenderDoAppend do_append;
    Log4gAppenderSetName set_name;
    Log4gAppenderGetName get_name;
    Log4gAppenderSetErrorHandler set_error_handler;
    Log4gAppenderGetErrorHandler get_error_handler;
    Log4gAppenderSetLayout set_layout;
    Log4gAppenderGetLayout get_layout;
    Log4gAppenderRequiresLayout requires_layout;
    Log4gAppenderActivateOptions activate_options;
} Log4gAppenderClass;

Log4gAppenderAddFilter add_filter;

Add a filter to the end of the filter chain.

Log4gAppenderGetFilter get_filter;

Get the first filter in the filter chain.

Log4gAppenderClose close;

Release all resources.

Log4gAppenderAppend append;

Perform actial logging.

Log4gAppenderDoAppend do_append;

Log in an appender-specific way.

Log4gAppenderSetName set_name;

Set the name of this appender.

Log4gAppenderGetName get_name;

Retrieve the name of this appender.

Log4gAppenderSetErrorHandler set_error_handler;

Set the error handler for this appender.

Log4gAppenderGetErrorHandler get_error_handler;

Retrieve the error handler for this appender.

Log4gAppenderSetLayout set_layout;

Set the layout for this appender.

Log4gAppenderGetLayout get_layout;

Get the layout for this appender.

Log4gAppenderRequiresLayout requires_layout;

Determine if this appender requires a layout.

Log4gAppenderActivateOptions activate_options;

Activate all options set for this appender.

log4g_appender_clear_filters ()

void                log4g_appender_clear_filters        (Log4gAppender *self);

Remove all filters attached to this appender.

self :

A Log4gAppender object.

Since 0.1


log4g_appender_add_filter ()

void                log4g_appender_add_filter           (Log4gAppender *self,
                                                         Log4gFilter *filter);

Calls the add_filter function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

filter :

A filter to add to self.

Since 0.1


log4g_appender_get_filter ()

Log4gFilter *       log4g_appender_get_filter           (Log4gAppender *self);

Calls the get_filter function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

Returns :

The first filter in the filter chain.

Since 0.1


log4g_appender_close ()

void                log4g_appender_close                (Log4gAppender *self);

Calls the close function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

Since 0.1


log4g_appender_do_append ()

void                log4g_appender_do_append            (Log4gAppender *self,
                                                         Log4gLoggingEvent *event);

Calls the do_append function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

event :

The log event to append.

Since 0.1


log4g_appender_get_name ()

const gchar *       log4g_appender_get_name             (Log4gAppender *self);

Calls the get_name function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

Returns :

The name of self (may be NULL).

Since 0.1


log4g_appender_set_error_handler ()

void                log4g_appender_set_error_handler    (Log4gAppender *self,
                                                         gpointer handler);

Calls the set_error_handler function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

handler :

The new error handler object for self.

Since 0.1


log4g_appender_get_error_handler ()

gpointer            log4g_appender_get_error_handler    (Log4gAppender *self);

Calls the get_error_handler function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

Returns :

The error handler object used by self.

Since 0.1


log4g_appender_set_layout ()

void                log4g_appender_set_layout           (Log4gAppender *self,
                                                         Log4gLayout *layout);

Calls the set_layout function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

layout :

The new layout for self.

Since 0.1


log4g_appender_get_layout ()

Log4gLayout *       log4g_appender_get_layout           (Log4gAppender *self);

Calls the get_layout function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

Returns :

The layout set for self.

Since 0.1


log4g_appender_set_name ()

void                log4g_appender_set_name             (Log4gAppender *self,
                                                         const gchar *name);

Calls the set_name function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

name :

The new name for this appender.

Since 0.1


log4g_appender_requires_layout ()

gboolean            log4g_appender_requires_layout      (Log4gAppender *self);

Calls the requires_layout function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

Since 0.1


log4g_appender_activate_options ()

void                log4g_appender_activate_options     (Log4gAppender *self);

Calls the activate_options function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

Since 0.1


log4g_appender_append ()

void                log4g_appender_append               (Log4gAppender *self,
                                                         Log4gLoggingEvent *event);

Calls the append function from the Log4gAppenderClass of self.

self :

A Log4gAppender object.

event :

A log event.

Since 0.1


log4g_appender_get_first_filter ()

Log4gFilter *       log4g_appender_get_first_filter     (Log4gAppender *self);

Retrieve the first filter in the filter chain.

self :

A Log4gAppender object.

Returns :

The first filter in the filter chain, or NULL if there is none.

Since 0.1


log4g_appender_is_as_severe_as ()

gboolean            log4g_appender_is_as_severe_as      (Log4gAppender *self,
                                                         Log4gLevel *level);

Determine if a log level is below the appender's threshold.

If there is no threshold set then the return value is always TRUE.

self :

A Log4gAppender object.

level :

A log level.

Returns :

TRUE if level is above the level threshold of this appender, FALSE otherwise.

Since 0.1


log4g_appender_set_threshold ()

void                log4g_appender_set_threshold        (Log4gAppender *self,
                                                         const gchar *threshold);

Set the threshold property for this appender.

self :

A Log4gAppender object.

threshold :

A string representation of a log level.

Since 0.1


log4g_appender_get_threshold ()

Log4gLevel *        log4g_appender_get_threshold        (Log4gAppender *self);

Retrieve the threshold property.

self :

A Log4gAppender object.

Returns :

The threshold value for this appender.

Since 0.1


log4g_appender_get_closed ()

gboolean            log4g_appender_get_closed           (Log4gAppender *self);

Determine if an appender has been closed.

self :

A Log4gAppender object.

Returns :

TRUE if this appender is closed, FALSE otherwise.

Since 0.1


log4g_appender_set_closed ()

void                log4g_appender_set_closed           (Log4gAppender *self,
                                                         gboolean closed);

Set the closed parameter.

Appenders should set this value appropriately. The default value is FALSE.

self :

A Log4gAppender object.

closed :

The new closed value for self.

Returns :

TRUE if this appender is closed, FALSE otherwise.

Since 0.1


Log4gAppenderAddFilter ()

void                (*Log4gAppenderAddFilter)           (Log4gAppender *self,
                                                         Log4gFilter *filter);

Add a filter to the end of the filter chain.

See: Log4gFilter

self :

A Log4gAppender object.

filter :

A Log4gFilter to add to this appender.

Since 0.1


Log4gAppenderGetFilter ()

Log4gFilter         (*Log4gAppenderGetFilter)           (Log4gAppender *self);

Filters are organized in a linked list so all filters are available through the result of this function.

See: Log4gFilter

self :

A Log4gAppender object.

Returns :

The first filter in the filter chain.

Since 0.1


Log4gAppenderClose ()

void                (*Log4gAppenderClose)               (Log4gAppender *self);

Release any resources allocated within the appender such as file handles, network connections, etc. A closed appender is no longer usable by the Log4g system.

self :

A Log4gAppender object.

Since 0.1


Log4gAppenderAppend ()

void                (*Log4gAppenderAppend)              (Log4gAppender *base,
                                                         Log4gLoggingEvent *event);

Sub-classes should implement this abstract virtual function to perform actual logging.

See: Log4gLoggingEvent

base :

An Log4gAppender object.

event :

A log event.

Since 0.1


Log4gAppenderDoAppend ()

void                (*Log4gAppenderDoAppend)            (Log4gAppender *self,
                                                         Log4gLoggingEvent *event);

Loggers will call this function in order to log events.

See: Log4gLoggingEvent

self :

A Log4gAppender object.

event :

The logging event to append.

Since 0.1


Log4gAppenderSetName ()

void                (*Log4gAppenderSetName)             (Log4gAppender *self,
                                                         const gchar *name);

The name may be used by other components to uniquely identify the appender.

self :

A Log4gAppender object.

name :

The new name for this appender.

Since 0.1


Log4gAppenderGetName ()

const gchar         (*Log4gAppenderGetName)             (Log4gAppender *self);

The name uniquely identifies this appender.

self :

A Log4gAppender object.

Returns :

The name of self (may be NULL).

Since 0.1


Log4gAppenderSetErrorHandler ()

void                (*Log4gAppenderSetErrorHandler)     (Log4gAppender *self,
                                                         gpointer handler);

Set the error handler for this appender.

See: Log4gErrorHandler

self :

An appender object.

handler :

An error handler.

Since 0.1


Log4gAppenderGetErrorHandler ()

gpointer            (*Log4gAppenderGetErrorHandler)     (Log4gAppender *self);

Retrieve the error handler for an appender.

See: Log4gErrorHandler

self :

A Log4gAppender object.

Returns :

The error handler set for this appender.

Since 0.1


Log4gAppenderSetLayout ()

void                (*Log4gAppenderSetLayout)           (Log4gAppender *self,
                                                         Log4gLayout *layout);

Set the layout for this appender.

See: Log4gLayout

self :

A Log4gAppender object.

layout :

The new layout for this appender.

Since 0.1


Log4gAppenderGetLayout ()

Log4gLayout         (*Log4gAppenderGetLayout)           (Log4gAppender *self);

Retrieve the layout for this appender.

See: Log4gLayout

self :

A Log4gAppender object.

Returns :

The layout for this appender;

Since 0.1


Log4gAppenderRequiresLayout ()

gboolean            (*Log4gAppenderRequiresLayout)      (Log4gAppender *self);

Configurators may call this method to determine if an appender requires a layout.

In the exceptional case where an appender accepts a layout but can also work without it the appender should return TRUE.

See: Log4gAppenderSetLayout, Log4gAppenderGetLayout, Log4gLayout

self :

A Log4gAppender object.

Returns :

TRUE if this appender requires a layout, FALSE otherwise.

Since 0.1


Log4gAppenderActivateOptions ()

void                (*Log4gAppenderActivateOptions)     (Log4gAppender *self);

Activate all options set for this appender.

self :

A Log4gAppender object.

Since 0.1