log4c_rollingpolicy.h man page

rollingpolicy.h — Log4c rolling policy interface. Defines the interface for managing and providing rolling policies.

Synopsis

#include <stdio.h>
#include <log4c/defs.h>
#include <log4c/layout.h>

Data Structures

struct log4c_rollingpolicy_type
log4c rollingpolicy type. Defines the interface a specific policy must provide to the rollingfile appender.

Macros

#define ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05

Typedefs

typedef struct __log4c_rollingpolicy log4c_rollingpolicy_t

typedef struct log4c_rollingpolicy_type log4c_rollingpolicy_type_t
log4c rollingpolicy type. Defines the interface a specific policy must provide to the rollingfile appender.

Functions

log4c_rollingpolicy_t * log4c_rollingpolicy_get (const char *policy_name)

const log4c_rollingpolicy_type_t * log4c_rollingpolicy_type_set (const log4c_rollingpolicy_type_t *a_type)

void log4c_rollingpolicy_set_udata (log4c_rollingpolicy_t *policyp, void *udatap)

int log4c_rollingpolicy_init (log4c_rollingpolicy_t *policyp, rollingfile_udata_t *rfup)

int log4c_rollingpolicy_fini (log4c_rollingpolicy_t *policyp)

int log4c_rollingpolicy_is_triggering_event (log4c_rollingpolicy_t *policyp, const log4c_logging_event_t *evtp, long current_file_size)

const log4c_rollingpolicy_type_t * log4c_rollingpolicy_set_type (log4c_rollingpolicy_t *a_rollingpolicy, const log4c_rollingpolicy_type_t *a_type)

const log4c_rollingpolicy_type_t * log4c_rollingpolicy_type_get (const char *a_name)

void * log4c_rollingpolicy_get_udata (const log4c_rollingpolicy_t *policyp)

rollingfile_udata_t * log4c_rollingpolicy_get_rfudata (const log4c_rollingpolicy_t *policyp)

Detailed Description

Log4c rolling policy interface. Defines the interface for managing and providing rolling policies.

A rolling policy is used to confogure a rollingfile appender to tell it when to trigger a rolover event.

Macro Definition Documentation

#define ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05

Effect a rollover according to policyp on the given file stream.

Parameters:

policyp pointer to the rolling policy
fp filestream to rollover.

Returns:

zero if successful, non-zero otherwise. The policy can return an indication that something went wrong but that the rollingfile appender can stull go ahead and log by returning an error code <= ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG. Anything greater than means that the rolling file appender will not try to log it's message.

Typedef Documentation

typedef struct __log4c_rollingpolicy log4c_rollingpolicy_t

log4c rollingpolicy type

typedef struct log4c_rollingpolicy_type log4c_rollingpolicy_type_t

log4c rollingpolicy type. Defines the interface a specific policy must provide to the rollingfile appender. Attributes description:

·
name rollingpolicy type name
·
init() init the rollingpolicy
·
is_triggering_event()
·
rollover()

Function Documentation

int log4c_rollingpolicy_fini (log4c_rollingpolicy_t * policyp)

Call the un initialization code of a rolling policy. This will call the fini routine of the particular rollingpolicy type to allow it to free up resources. If the call to fini in the rollingpolicy type fails then the rollingpolicy is not uninitialized. Try again later model...

Parameters:

policyp pointer to the rolling policy

Returns:

zero if successful, non-zero otherwise.

log4c_rollingpolicy_t* log4c_rollingpolicy_get (const char * policy_name)

Get a new rolling policy

Parameters:

policy_name a name for the policy

Returns:

a new rolling policy, otherwise NULL.

rollingfile_udata_t* log4c_rollingpolicy_get_rfudata (const log4c_rollingpolicy_t * policyp)

Get the rollingfile appender associated with this policy.

Parameters:

policyp pointer to the rolling policy

Returns:

pointer to the rolling file appender associated with this policy

void* log4c_rollingpolicy_get_udata (const log4c_rollingpolicy_t * policyp)

Get the rolling policy configuration.

Parameters:

policyp pointer to the rolling policy

Returns:

pointer to the rolling policy configuration.

int log4c_rollingpolicy_init (log4c_rollingpolicy_t * policyp, rollingfile_udata_t * rfup)

Call the initialization code of a rolling policy.

Parameters:

policyp pointer to the rolling policy
rfup the rolling appender user data this policy is used with

Returns:

zero if successful, non-zero otherwise.

int log4c_rollingpolicy_is_triggering_event (log4c_rollingpolicy_t * policyp, const log4c_logging_event_t * evtp, long current_file_size)

Determine if a logging event should trigger a rollover according to the given policy.

Parameters:

policyp pointer to the rolling policy
evtp the logging event pointer.
current_file_size the size of the current file being logged to.

Returns:

non-zero if rollover required, zero otherwise.

const log4c_rollingpolicy_type_t* log4c_rollingpolicy_set_type (log4c_rollingpolicy_t * a_rollingpolicy, const log4c_rollingpolicy_type_t * a_type)

sets the rolling policy type

Parameters:

a_rollingpolicy the log4c_rollingpolicy_t object
a_type the new rollingpolicy type

Returns:

the previous appender type

void log4c_rollingpolicy_set_udata (log4c_rollingpolicy_t * policyp, void * udatap)

Configure a rolling policy with a specific policy.

Parameters:

policyp pointer to the rolling policy
udatap a specific policy type, for example sizewin.

Returns:

zero if successful, non-zero otherwise.

const log4c_rollingpolicy_type_t* log4c_rollingpolicy_type_get (const char * a_name)

Get a pointer to an existing rollingpolicy type.

Parameters:

a_name the name of the rollingpolicy type to return.

Returns:

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

const log4c_rollingpolicy_type_t* log4c_rollingpolicy_type_set (const log4c_rollingpolicy_type_t * a_type)

Use this function to register a rollingpolicy 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 rollingpolicy type to register.

Returns:

a pointer to the previous rollingpolicy type of same name.

Example code fragment:

const log4c_rollingpolicy_type_t log4c_rollingpolicy_type_sizewin = {
  "sizewin",
  sizewin_init,
  sizewin_is_triggering_event,
  sizewin_rollover
};

log4c_rollingpolicy_type_set(&log4c_rollingpolicy_type_sizewin);

Author

Generated automatically by Doxygen for log4c from the source code.

Referenced By

log4c_rollingpolicy_fini(3), log4c_rollingpolicy_get(3), log4c_rollingpolicy_get_rfudata(3), log4c_rollingpolicy_get_udata(3), log4c_rollingpolicy_init(3), log4c_rollingpolicy_is_triggering_event(3), log4c_ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG(3), log4c_rollingpolicy_set_type(3), log4c_rollingpolicy_set_udata(3), log4c_rollingpolicy_t(3), log4c_rollingpolicy_type_get(3), log4c_rollingpolicy_type_set(3) and log4c_rollingpolicy_type_t(3) are aliases of log4c_rollingpolicy.h(3).

Thu Nov 3 2016 Version 1.2.4 log4c