#include <stdio.h>
#include <log4c/defs.h>
#include <log4c/layout.h>
Go to the source code of this file.
Data Structures | |
struct | log4c_rollingpolicy_type |
log4c rollingpolicy type. Defines the interface a specific policy must provide to the rollingfile appender. More... | |
Defines | |
#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_API log4c_rollingpolicy_t * | log4c_rollingpolicy_get (const char *policy_name) |
LOG4C_API const log4c_rollingpolicy_type_t * | log4c_rollingpolicy_type_set (const log4c_rollingpolicy_type_t *a_type) |
LOG4C_API void | log4c_rollingpolicy_set_udata (log4c_rollingpolicy_t *policyp, void *udatap) |
LOG4C_API int | log4c_rollingpolicy_init (log4c_rollingpolicy_t *policyp, rollingfile_udata_t *rfup) |
LOG4C_API int | log4c_rollingpolicy_fini (log4c_rollingpolicy_t *a_this) |
LOG4C_API int | log4c_rollingpolicy_is_triggering_event (log4c_rollingpolicy_t *policyp, const log4c_logging_event_t *evtp, long current_file_size) |
LOG4C_API const log4c_rollingpolicy_type_t * | log4c_rollingpolicy_set_type (log4c_rollingpolicy_t *a_rollingpolicy, const log4c_rollingpolicy_type_t *a_type) |
LOG4C_API const log4c_rollingpolicy_type_t * | log4c_rollingpolicy_type_get (const char *a_name) |
LOG4C_API void * | log4c_rollingpolicy_get_udata (const log4c_rollingpolicy_t *policyp) |
LOG4C_API rollingfile_udata_t * | log4c_rollingpolicy_get_rfudata (const log4c_rollingpolicy_t *policyp) |
A rolling policy is used to confogure a rollingfile appender to tell it when to trigger a rolover event.
#define ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05 |
Effect a rollover according to policyp on the given file stream.
policyp | pointer to the rolling policy | |
fp | filestream to rollover. |
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()
LOG4C_API int log4c_rollingpolicy_fini | ( | log4c_rollingpolicy_t * | a_this | ) |
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...
policyp | pointer to the rolling policy |
LOG4C_API log4c_rollingpolicy_t* log4c_rollingpolicy_get | ( | const char * | policy_name | ) |
Get a new rolling policy
policy_name | a name for the policy |
LOG4C_API rollingfile_udata_t* log4c_rollingpolicy_get_rfudata | ( | const log4c_rollingpolicy_t * | policyp | ) |
Get the rollingfile appender associated with this policy.
policyp | pointer to the rolling policy |
LOG4C_API void* log4c_rollingpolicy_get_udata | ( | const log4c_rollingpolicy_t * | policyp | ) |
Get the rolling policy configuration.
policyp | pointer to the rolling policy |
LOG4C_API int log4c_rollingpolicy_init | ( | log4c_rollingpolicy_t * | policyp, | |
rollingfile_udata_t * | rfup | |||
) |
Call the initialization code of a rolling policy.
policyp | pointer to the rolling policy | |
app | the rolling appender this policy is used with |
LOG4C_API 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.
policyp | pointer to the rolling policy | |
evtp | the logging event pointer. | |
current_file_size | the size of the current file being logged to. |
LOG4C_API 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
a_rollingpolicy | the log4c_rollingpolicy_t object | |
a_type | the new rollingpolicy type |
LOG4C_API void log4c_rollingpolicy_set_udata | ( | log4c_rollingpolicy_t * | policyp, | |
void * | udatap | |||
) |
Configure a rolling policy with a specific policy.
policyp | pointer to the rolling policy | |
udatap | a specific policy type, for example sizewin. |
LOG4C_API const log4c_rollingpolicy_type_t* log4c_rollingpolicy_type_get | ( | const char * | a_name | ) |
Get a pointer to an existing rollingpolicy type.
a_name | the name of the rollingpolicy type to return. |
LOG4C_API 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.
a_type | a pointer to the new rollingpolicy type to register. |
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);
References log4c_rollingpolicy_type::name.