Log4g Reference Manual | ||||
---|---|---|---|---|
Top | Description |
Log4gFilter; Log4gFilterClass; enum Log4gFilterDecision; Log4gFilterDecision log4g_filter_decide (Log4gFilter *self
,Log4gLoggingEvent *event
); void log4g_filter_activate_options (Log4gFilter *self
); Log4gFilter * log4g_filter_get_next (Log4gFilter *self
); void log4g_filter_set_next (Log4gFilter *self
,Log4gFilter *next
); Log4gFilterDecision (*Log4gFilterDecide) (Log4gFilter *self
,Log4gLoggingEvent *event
); void (*Log4gFilterActivateOptions) (Log4gFilter *self
);
Users may extend this class to implement custom log event filtering. Note that Log4gLogger & Log4gAppenderSkeleton (the parent of all standard appenders) have builtin filter rules. You should understand and use the builtin rules before writing custom filters.
Filters are organized in a linear chain. Log4gAppenderSkeleton calls the
decide()
function of each filter sequentially in order to determine the
outcome of the filtering process.
Sub-classes must override the decide()
virtual function. This function
must return one of the integer constants LOG4G_FILTER_DENY
,
LOG4G_FILTER_NEUTRAL
, or LOG4G_FILTER_ACCEPT
.
If the value LOG4G_FILTER_DENY
is returned the log event is dropped
immediately without consulting the remaining filters.
If the value LOG4G_FILTER_NEUTRAL
is returned the remaining filters in
the chain are consulted. If the final filter returns LOG4G_FILTER_NEUTRAL
then the log event is logged. If no filters exist then all messages are
logged.
If the value LOG4G_FILTER_ACCEPT
is returned the the log event is logged
immediately without consulting the remaining filters.
typedef struct { } Log4gFilter;
The Log4gFilter structure does not have any public members.
typedef struct { Log4gFilterDecide decide; Log4gFilterActivateOptions activate_options; } Log4gFilterClass;
Log4gFilterDecide |
Implements the filter decision. |
Log4gFilterActivateOptions |
Activate all options set for this filter. |
typedef enum { LOG4G_FILTER_ACCEPT = 1, LOG4G_FILTER_NEUTRAL = 0, LOG4G_FILTER_DENY = -1 } Log4gFilterDecision;
The log event must be logged immediately. The remaining filters (if any) should not be consulted. | |
This filter is neutral regarding the event. The remaining filters (if any) should be consulted for a final decision. | |
The log event must dropped immediately. The remaining filters (if any) should not be consulted. |
Log4gFilterDecision log4g_filter_decide (Log4gFilter *self
,Log4gLoggingEvent *event
);
Calls the decide
function from the Log4gFilterClass of self
.
|
A Log4gFilter object. |
|
A logging event. |
Returns : |
A filter decision based upon the logging event. |
Since 0.1
void log4g_filter_activate_options (Log4gFilter *self
);
Calls the activate_options
function from the Log4gFilterClass of self
.
Filters generally need to have their options activated before they can be used. This class provides a do-nothing implementation for convenience.
|
A Log4gFilter object. |
Since 0.1
Log4gFilter * log4g_filter_get_next (Log4gFilter *self
);
Retrieve the next filter in the chain.
Filters are chained together. This function returns the next filter in
the chain, or NULL
if there are no more.
|
A Log4gFilter object. |
Returns : |
The next filter in the chain, or \e NULL if there are no more. |
Since 0.1
void log4g_filter_set_next (Log4gFilter *self
,Log4gFilter *next
);
Set the next filter in the chain.
Filters are chained together. This function sets the filter that will follow this one in the chain.
|
A filter object. |
|
The filter to set as the next in the chain. |
Since 0.1
Log4gFilterDecision (*Log4gFilterDecide) (Log4gFilter *self
,Log4gLoggingEvent *event
);
If the decision is LOG4G_FILTER_DENY
, the even will be dropped. If
the decision is LOG4G_FILTER_ACCEPT
, then any remaining filters
will be invoked. If the decision is LOG4G_FILTER_ACCEPT
the
event will be logged without consulting any other filters in the
chain.
|
A Log4gFilter object. |
|
A logging event. |
Returns : |
A filter decision based upon the logging event. |
Since 0.1
void (*Log4gFilterActivateOptions) (Log4gFilter *self
);
Activate all options set for this filter.
|
A Log4gFilter object. |
Since 0.1