.TH "rollingpolicy.h" 3 "Version 1.2.4" "log4c" \" -*- nroff -*- .ad l .nh .SH NAME rollingpolicy.h \- Log4c rolling policy interface\&. Defines the interface for managing and providing rolling policies\&. .SH SYNOPSIS .br .PP \fC#include \fP .br \fC#include \fP .br \fC#include \fP .br .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBlog4c_rollingpolicy_type\fP" .br .RI "log4c rollingpolicy type\&. Defines the interface a specific policy must provide to the rollingfile appender\&. " .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG\fP 0x05" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef struct __log4c_rollingpolicy \fBlog4c_rollingpolicy_t\fP" .br .ti -1c .RI "typedef struct \fBlog4c_rollingpolicy_type\fP \fBlog4c_rollingpolicy_type_t\fP" .br .RI "log4c rollingpolicy type\&. Defines the interface a specific policy must provide to the rollingfile appender\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "\fBlog4c_rollingpolicy_t\fP * \fBlog4c_rollingpolicy_get\fP (const char *policy_name)" .br .ti -1c .RI "const \fBlog4c_rollingpolicy_type_t\fP * \fBlog4c_rollingpolicy_type_set\fP (const \fBlog4c_rollingpolicy_type_t\fP *a_type)" .br .ti -1c .RI "void \fBlog4c_rollingpolicy_set_udata\fP (\fBlog4c_rollingpolicy_t\fP *policyp, void *udatap)" .br .ti -1c .RI "int \fBlog4c_rollingpolicy_init\fP (\fBlog4c_rollingpolicy_t\fP *policyp, rollingfile_udata_t *rfup)" .br .ti -1c .RI "int \fBlog4c_rollingpolicy_fini\fP (\fBlog4c_rollingpolicy_t\fP *policyp)" .br .ti -1c .RI "int \fBlog4c_rollingpolicy_is_triggering_event\fP (\fBlog4c_rollingpolicy_t\fP *policyp, const \fBlog4c_logging_event_t\fP *evtp, long current_file_size)" .br .ti -1c .RI "const \fBlog4c_rollingpolicy_type_t\fP * \fBlog4c_rollingpolicy_set_type\fP (\fBlog4c_rollingpolicy_t\fP *a_rollingpolicy, const \fBlog4c_rollingpolicy_type_t\fP *a_type)" .br .ti -1c .RI "const \fBlog4c_rollingpolicy_type_t\fP * \fBlog4c_rollingpolicy_type_get\fP (const char *a_name)" .br .ti -1c .RI "void * \fBlog4c_rollingpolicy_get_udata\fP (const \fBlog4c_rollingpolicy_t\fP *policyp)" .br .ti -1c .RI "rollingfile_udata_t * \fBlog4c_rollingpolicy_get_rfudata\fP (const \fBlog4c_rollingpolicy_t\fP *policyp)" .br .in -1c .SH "Detailed Description" .PP 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\&. .SH "Macro Definition Documentation" .PP .SS "#define ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05" Effect a rollover according to policyp on the given file stream\&. .PP \fBParameters\fP .RS 4 \fIpolicyp\fP pointer to the rolling policy .br \fIfp\fP filestream to rollover\&. .RE .PP \fBReturns\fP .RS 4 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\&. .RE .PP .SH "Typedef Documentation" .PP .SS "typedef struct __log4c_rollingpolicy \fBlog4c_rollingpolicy_t\fP" log4c rollingpolicy type .SS "typedef struct \fBlog4c_rollingpolicy_type\fP \fBlog4c_rollingpolicy_type_t\fP" .PP log4c rollingpolicy type\&. Defines the interface a specific policy must provide to the rollingfile appender\&. Attributes description: .PP .PD 0 .IP "\(bu" 1 \fCname\fP rollingpolicy type name .IP "\(bu" 1 \fCinit()\fP init the rollingpolicy .IP "\(bu" 1 \fCis_triggering_event()\fP .IP "\(bu" 1 \fCrollover()\fP .PP .SH "Function Documentation" .PP .SS "int log4c_rollingpolicy_fini (\fBlog4c_rollingpolicy_t\fP * 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\&.\&.\&. .PP \fBParameters\fP .RS 4 \fIpolicyp\fP pointer to the rolling policy .RE .PP \fBReturns\fP .RS 4 zero if successful, non-zero otherwise\&. .RE .PP .SS "\fBlog4c_rollingpolicy_t\fP * log4c_rollingpolicy_get (const char * policy_name)" Get a new rolling policy .PP \fBParameters\fP .RS 4 \fIpolicy_name\fP a name for the policy .RE .PP \fBReturns\fP .RS 4 a new rolling policy, otherwise NULL\&. .RE .PP .SS "rollingfile_udata_t * log4c_rollingpolicy_get_rfudata (const \fBlog4c_rollingpolicy_t\fP * policyp)" Get the rollingfile appender associated with this policy\&. .PP \fBParameters\fP .RS 4 \fIpolicyp\fP pointer to the rolling policy .RE .PP \fBReturns\fP .RS 4 pointer to the rolling file appender associated with this policy .RE .PP .SS "void * log4c_rollingpolicy_get_udata (const \fBlog4c_rollingpolicy_t\fP * policyp)" Get the rolling policy configuration\&. .PP \fBParameters\fP .RS 4 \fIpolicyp\fP pointer to the rolling policy .RE .PP \fBReturns\fP .RS 4 pointer to the rolling policy configuration\&. .RE .PP .SS "int log4c_rollingpolicy_init (\fBlog4c_rollingpolicy_t\fP * policyp, rollingfile_udata_t * rfup)" Call the initialization code of a rolling policy\&. .PP \fBParameters\fP .RS 4 \fIpolicyp\fP pointer to the rolling policy .br \fIrfup\fP the rolling appender user data this policy is used with .RE .PP \fBReturns\fP .RS 4 zero if successful, non-zero otherwise\&. .RE .PP .SS "int log4c_rollingpolicy_is_triggering_event (\fBlog4c_rollingpolicy_t\fP * policyp, const \fBlog4c_logging_event_t\fP * evtp, long current_file_size)" Determine if a logging event should trigger a rollover according to the given policy\&. .PP \fBParameters\fP .RS 4 \fIpolicyp\fP pointer to the rolling policy .br \fIevtp\fP the logging event pointer\&. .br \fIcurrent_file_size\fP the size of the current file being logged to\&. .RE .PP \fBReturns\fP .RS 4 non-zero if rollover required, zero otherwise\&. .RE .PP .SS "const \fBlog4c_rollingpolicy_type_t\fP * log4c_rollingpolicy_set_type (\fBlog4c_rollingpolicy_t\fP * a_rollingpolicy, const \fBlog4c_rollingpolicy_type_t\fP * a_type)" sets the rolling policy type .PP \fBParameters\fP .RS 4 \fIa_rollingpolicy\fP the log4c_rollingpolicy_t object .br \fIa_type\fP the new rollingpolicy type .RE .PP \fBReturns\fP .RS 4 the previous appender type .RE .PP .SS "void log4c_rollingpolicy_set_udata (\fBlog4c_rollingpolicy_t\fP * policyp, void * udatap)" Configure a rolling policy with a specific policy\&. .PP \fBParameters\fP .RS 4 \fIpolicyp\fP pointer to the rolling policy .br \fIudatap\fP a specific policy type, for example sizewin\&. .RE .PP \fBReturns\fP .RS 4 zero if successful, non-zero otherwise\&. .RE .PP .SS "const \fBlog4c_rollingpolicy_type_t\fP * log4c_rollingpolicy_type_get (const char * a_name)" Get a pointer to an existing rollingpolicy type\&. .PP \fBParameters\fP .RS 4 \fIa_name\fP the name of the rollingpolicy type to return\&. .br .RE .PP \fBReturns\fP .RS 4 a pointer to an existing rollingpolicy type, or NULL if no rollingpolicy type with the specified name exists\&. .RE .PP .SS "const \fBlog4c_rollingpolicy_type_t\fP * log4c_rollingpolicy_type_set (const \fBlog4c_rollingpolicy_type_t\fP * 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\&. .PP \fBParameters\fP .RS 4 \fIa_type\fP a pointer to the new rollingpolicy type to register\&. .RE .PP \fBReturns\fP .RS 4 a pointer to the previous rollingpolicy type of same name\&. .RE .PP Example code fragment: .PP .nf 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); .fi .PP .SH "Author" .PP Generated automatically by Doxygen for log4c from the source code\&.