Log4gLayout

Log4gLayout — Log event layout base class

Synopsis

#define             LOG4G_LAYOUT_LINE_SEP
                    Log4gLayout;
                    Log4gLayoutClass;
gchar *             log4g_layout_format                 (Log4gLayout *self,
                                                         Log4gLoggingEvent *event);
const gchar *       log4g_layout_get_content_type       (Log4gLayout *self);
const gchar *       log4g_layout_get_header             (Log4gLayout *self);
const gchar *       log4g_layout_get_footer             (Log4gLayout *self);
void                log4g_layout_activate_options       (Log4gLayout *self);
gchar               (*Log4gLayoutFormat)                (Log4gLayout *self,
                                                         Log4gLoggingEvent *event);
const gchar         (*Log4gLayoutGetContentType)        (Log4gLayout *self);
const gchar         (*Log4gLayoutGetHeader)             (Log4gLayout *self);
const gchar         (*Log4gLayoutGetFooter)             (Log4gLayout *self);
void                (*Log4gLayoutActivateOptions)       (Log4gLayout *self);

Description

Users may extend this class to implement custom log event layouts.

Many appenders require a layout in order to log an event. Sub-classes must override the _Log4gLayoutClass::format() virtual function to implement custom formatting.

Details

LOG4G_LAYOUT_LINE_SEP

#define LOG4G_LAYOUT_LINE_SEP "\n"

Log4gLayout

typedef struct {
} Log4gLayout;

The Log4gLayout structure does not have any public members.


Log4gLayoutClass

typedef struct {
    Log4gLayoutFormat format;
    Log4gLayoutGetContentType get_content_type;
    Log4gLayoutGetHeader get_header;
    Log4gLayoutGetFooter get_footer;
    Log4gLayoutActivateOptions activate_options;
} Log4gLayoutClass;

Log4gLayoutFormat format;

Implement this function to create your own layout format.

Log4gLayoutGetContentType get_content_type;

Retrieve the content type output by this layout.

Log4gLayoutGetHeader get_header;

Retrieve the header for this layout.

Log4gLayoutGetFooter get_footer;

Retrieve the footer for this layout.

Log4gLayoutActivateOptions activate_options;

Activate all options set for this layout.

log4g_layout_format ()

gchar *             log4g_layout_format                 (Log4gLayout *self,
                                                         Log4gLoggingEvent *event);

Calls the format function from the Log4gLayoutClass of self.

self :

A layout object.

event :

A logging event object to be laid out.

Returns :

The formatted logging event.

Since 0.1


log4g_layout_get_content_type ()

const gchar *       log4g_layout_get_content_type       (Log4gLayout *self);

Calls the get_content_type function from the Log4gLayoutClass of self.

self :

A layout object.

Returns :

The layout content type.

Since 0.1


log4g_layout_get_header ()

const gchar *       log4g_layout_get_header             (Log4gLayout *self);

Calls the get_header function from the Log4gLayoutClass of self.

self :

A layout object.

Returns :

The layout header.

Since 0.1


log4g_layout_get_footer ()

const gchar *       log4g_layout_get_footer             (Log4gLayout *self);

Calls the get_footer function from the Log4gLayoutClass of self.

self :

A layout object.

Returns :

The layout footer.

Since 0.1


log4g_layout_activate_options ()

void                log4g_layout_activate_options       (Log4gLayout *self);

Calls the activate_options function from the Log4gLayoutClass of self.

Layouts generally need to have their options activated before they can be used. This class provides a do-nothing implementation for convenience.

self :

A layout object.

Since 0.1


Log4gLayoutFormat ()

gchar               (*Log4gLayoutFormat)                (Log4gLayout *self,
                                                         Log4gLoggingEvent *event);

Implement this function to create your own layout format.

self :

A layout object.

event :

A logging event object to be laid out.

Returns :

The formatted logging event.

Since 0.1


Log4gLayoutGetContentType ()

const gchar         (*Log4gLayoutGetContentType)        (Log4gLayout *self);

Retrieve the content type output by this layout.

The base class returns "text/plain".

self :

A layout object.

Returns :

The layout content type.

Since 0.1


Log4gLayoutGetHeader ()

const gchar         (*Log4gLayoutGetHeader)             (Log4gLayout *self);

Retrieve the header for the layout format.

The base class returns \e NULL.

self :

A layout object.

Returns :

The layout header.

Since 0.1


Log4gLayoutGetFooter ()

const gchar         (*Log4gLayoutGetFooter)             (Log4gLayout *self);

Retrieve the footer for the layout format.

The base class returns \e NULL.

self :

A layout object.

Returns :

The layout footer.

Since 0.1


Log4gLayoutActivateOptions ()

void                (*Log4gLayoutActivateOptions)       (Log4gLayout *self);

Activate all options set for this layout.

self :

An layout object.

Since 0.1