rollingpolicy.h(3)
π NAME π
okay so bestie, welcome to rollingpolicy.h β it's the Log4c rolling policy interface. π
It defines the interface for managing and providing rolling policies. That's it, that's the whole vibe. It lives in the Library Functions Manual section 3, so it's a library-functions girlie, not a syscall one. π¦
β¨ 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. literally the blueprint, no cap.
πΈ Macros
#define ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05
πΈ Typedefs
typedef struct __log4c_rollingpolicy log4c_rollingpolicy_ttypedef 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. (yes bestie, that's the original's spelling, i'm just the messenger π iykyk)
π₯ Macro Definition Documentation π₯
#define ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05
Effect a rollover according to policyp on the given file stream. π dramatic but true.
Parameters
policypβ pointer to the rolling policyfpβ 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. so likeβ¦ <= 0x05 is "messy but we move", > 0x05 is "no ma'am, we are NOT logging that". π«
π¦ Typedef Documentation π¦
typedef struct __log4c_rollingpolicy log4c_rollingpolicy_t
log4c rollingpolicy type. simple. iconic. π
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 nameinit()β init the rollingpolicyis_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β¦ π
(yes, literally β "try again later", the manpage said it, not me)
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 policyrfupβ 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. vibe check on the event, basically. π«£
Parameters
policypβ pointer to the rolling policyevtpβ 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β thelog4c_rollingpolicy_tobjecta_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 policyudatapβ a specific policy type, for examplesizewin.
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.
okay that's the whole page bestie, you ate that π
β¨ this was log4c, Version 1.2.4, page rollingpolicy.h(3) β go forth and roll those policies, no cap π«Άπ
π¦ where this page comes from
- fedora 43: log4c-devel 1.2.4-34.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: log4c-devel 1.2.4-34.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: log4c-devel 1.2.4-35.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: log4c-devel 1.2.4-35.fc44 Β· LicenseRef-Callaway-LGPLv2+
- ubuntu stonking: liblog4c-doc 1.2.4-6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms