category.h(3)
π category.h(3) π β the one where the categories get hierarchical
okay so bestie, welcome to category.h(3), straight out of the Library Functions Manual π«Ά. This is the central class in the log4c package, and honestly? it's giving main character energy. Sit down, grab a strawberry π, we're doing this properly.
β¨ NAME β¨
category.h β the central class in the log4c package. π
π SYNOPSIS π
#include <stdio.h>
#include <stdarg.h>
#include <log4c/defs.h>
#include <log4c/priority.h>
#include <log4c/location_info.h>
π Macros
#define log4c_category_define(a_category, a_name)
π Typedefs
typedef struct __log4c_category log4c_category_t
π Functions
log4c_category_t * log4c_category_get (const char *a_name)
int log4c_category_list (log4c_category_t **a_cats, int a_ncats)
log4c_category_t * log4c_category_new (const char *a_name)
void log4c_category_delete (log4c_category_t *a_category)
const char * log4c_category_get_name (const log4c_category_t
*a_category)
const struct __log4c_appender * log4c_category_get_appender (const
log4c_category_t *a_category)
int log4c_category_get_additivity (const log4c_category_t *a_category)
int log4c_category_get_priority (const log4c_category_t *a_category)
int log4c_category_get_chainedpriority (const log4c_category_t
*a_category)
const struct __log4c_appender * log4c_category_set_appender
(log4c_category_t *a_category, struct __log4c_appender *a_appender)
int log4c_category_set_priority (log4c_category_t *a_category, int
a_priority)
int log4c_category_set_additivity (log4c_category_t *a_category, int
a_additivity)
void log4c_category_print (const log4c_category_t *a_category, FILE
*a_stream)
static int log4c_category_is_priority_enabled (const log4c_category_t
*a_category, int a_priority)
static int log4c_category_is_fatal_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_alert_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_crit_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_error_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_warn_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_notice_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_info_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_debug_enabled (const log4c_category_t
*a_category)
static int log4c_category_is_trace_enabled (const log4c_category_t
*a_category)
static LOG4C_INLINE void log4c_category_log (const log4c_category_t
*a_category, int a_priority, const char *a_format,...)
static LOG4C_INLINE void log4c_category_log_locinfo (const
log4c_category_t *a_category, const log4c_location_info_t
*a_locinfo, int a_priority, const char *a_format,...)
static LOG4C_INLINE void log4c_category_fatal (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void log4c_category_alert (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void log4c_category_crit (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void log4c_category_error (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void log4c_category_warn (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void log4c_category_notice (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void log4c_category_info (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void log4c_category_debug (const log4c_category_t
*a_category, const char *a_format,...)
static LOG4C_INLINE void __log4c_category_trace (const log4c_category_t
*a_category, const char *a_format,...)
look at all those lil functions, they're literally a whole friend group π
πΈ Detailed Description πΈ
central class in the log4c package.
One of the distinctive features of log4j (and hence log4c) are hierarchical categories and their evaluation. π§
π Macro Definition Documentation π
#define log4c_category_define( a_category, a_name)
Helper macro to define static categories. so helpful fr fr π«Ά
Parameters
a_categoryβ thelog4c_category_tpointer namea_nameβ the category name
π¦ Typedef Documentation π¦
typedef struct __log4c_category log4c_category_t
log4c category class π
π Function Documentation π
LOG4C_INLINE void __log4c_category_trace (const log4c_category_t * a_category, const char * a_format, ...) [static]
Log a message with trace priority. the lowest of the low, but still iconic β¨
Parameters
a_categoryβ thelog4c_category_tobjecta_formatβ Format specifier for the string to write in the log file....β The arguments fora_format
References __log4c_category_trace(), log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_TRACE.
LOG4C_INLINE void log4c_category_alert (const log4c_category_t * a_category, const char * a_format, ...) [static]
Log a message with alert priority. π¨
Parameters
a_categoryβ thelog4c_category_tobjecta_formatβ Format specifier for the string to write in the log file....β The arguments fora_format
References log4c_category_alert(), log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_ALERT.
LOG4C_INLINE void log4c_category_crit (const log4c_category_t * a_category, const char * a_format, ...) [static]
Log a message with crit priority. π
Parameters
a_categoryβ thelog4c_category_tobjecta_formatβ Format specifier for the string to write in the log file....β The arguments fora_format
References log4c_category_crit(), log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_CRIT.
LOG4C_INLINE void log4c_category_debug (const log4c_category_t * a_category, const char * a_format, ...) [static]
Log a message with debug priority. the gossip your code tells you when nobody's watching π
Parameters
a_categoryβ thelog4c_category_tobjecta_formatβ Format specifier for the string to write in the log file....β The arguments fora_format
References log4c_category_debug(), log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_DEBUG.
void log4c_category_delete (log4c_category_t * a_category)
Destructor for a log4c_category_t. it's over bestie, say bye π
Parameters
a_categoryβ thelog4c_category_tobject
LOG4C_INLINE void log4c_category_error (const log4c_category_t * a_category, const char * a_format, ...) [static]
Log a message with error priority. not the vibe but okay π«
Parameters
a_categoryβ thelog4c_category_tobjecta_formatβ Format specifier for the string to write in the log file....β The arguments fora_format
References log4c_category_error(), log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_ERROR.
LOG4C_INLINE void log4c_category_fatal (const log4c_category_t * a_category, const char * a_format, ...) [static]
Log a message with fatal priority. the drama. the finale. π
Parameters
a_categoryβ thelog4c_category_tobjecta_formatβ Format specifier for the string to write in the log file....β The arguments fora_format
References log4c_category_fatal(), log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_FATAL.
log4c_category_t * log4c_category_get (const char * a_name)
Instantiate a log4c_category_t with name name. This method does not set priority of the category which is by default LOG4C_PRIORITY_NOTSET. no cap, it just leaves it unset. π
Parameters
a_nameβ The name of the category to retrieve.
Bug β the root category name should be""not"root". *
not me pointing out the original author's own bug π respect tho.
int log4c_category_get_additivity (const log4c_category_t * a_category)
Get the additivity flag for this log4c_category_t.. (two dots, iconic, keep them) β¨
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- the category additivity
const struct __log4c_appender * log4c_category_get_appender (const log4c_category_t * a_category)
Returns the Appender for this log4c_category_t, or NULL if no Appender has been set. π«Ά
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- The Appender.
int log4c_category_get_chainedpriority (const log4c_category_t * a_category)
Starting from this category, search the category hierarchy for a set priority and return it. Otherwise, return the priority of the root category. it's climbing the family tree for answers π³
Parameters
a_categoryβ thelog4c_category_tobject
Todo β the log4c_category_t is designed so that this method executes as quickly as possible. It could even be faster if the set priority was propagated through the children hierarchy of a category.
References LOG4C_PRIORITY_NOTSET, and LOG4C_PRIORITY_UNKNOWN.
const char * log4c_category_get_name (const log4c_category_t * a_category)
Return the category name. that's it, that's the whole job π
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- the category name.
int log4c_category_get_priority (const log4c_category_t * a_category)
Returns the assigned Priority, if any, for this log4c_category_t. β¨
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- Priority β the assigned Priority, can be
LOG4C_PRIORITY_NOTSET
References LOG4C_PRIORITY_UNKNOWN.
LOG4C_INLINE void log4c_category_info (const log4c_category_t * a_category, const char * a_format, ...) [static]
Log a message with info priority. just keeping you posted bestie π«Ά
Parameters
a_categoryβ thelog4c_category_tobjecta_formatβ Format specifier for the string to write in the log file....β The arguments fora_format
References log4c_category_info(), log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_INFO.
int log4c_category_is_alert_enabled (const log4c_category_t * a_category) [inline], [static]
Return true if the category will log messages with priority LOG4C_PRIORITY_ALERT. π¨
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- Whether the category will log.
References log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_ALERT.
int log4c_category_is_crit_enabled (const log4c_category_t * a_category) [inline], [static]
Return true if the category will log messages with priority LOG4C_PRIORITY_CRIT. π
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- Whether the category will log.
References log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_CRIT.
int log4c_category_is_debug_enabled (const log4c_category_t * a_category) [inline], [static]
Return true if the category will log messages with priority LOG4C_PRIORITY_DEBUG. π
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- Whether the category will log.
References log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_DEBUG.
int log4c_category_is_error_enabled (const log4c_category_t * a_category) [inline], [static]
Return true if the category will log messages with priority LOG4C_PRIORITY_ERROR. π«
Parameters
a_categoryβ thelog4c_category_tobject
Returns
- Whether the category will log.
References log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_ERROR.
and bestieβ¦ we're literally not even done, there's a whole part 2 loading π don't go anywhere π«Ά
okay bestie we're still in the function zone π the previous part was already serving function energy, so we're just gonna keep the list going, no heading repeats, no recap, just vibes and full API coverage. let's go π«Ά
log4c_category_is_fatal_enabled
int log4c_category_is_fatal_enabled (const log4c_category_t * a_category)
[inline], [static]
Returns true if this category is gonna log messages at priority LOG4C_PRIORITY_FATAL. πβ¨
a_categoryβ thelog4c_category_tobject, bestie
Returns: whether the category will log, periodt.
References: log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_FATAL.
log4c_category_is_info_enabled
int log4c_category_is_info_enabled (const log4c_category_t * a_category)
[inline], [static]
Returns true if the category will log messages with priority LOG4C_PRIORITY_INFO. β¨
a_categoryβ thelog4c_category_tobject
Returns: whether the category will log.
References: log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_INFO.
log4c_category_is_notice_enabled
int log4c_category_is_notice_enabled (const log4c_category_t * a_category)
[inline], [static]
Returns true if the category will log messages with priority LOG4C_PRIORITY_NOTICE. πΈ
a_categoryβ thelog4c_category_tobject
Returns: whether the category will log.
References: log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_NOTICE.
log4c_category_is_priority_enabled
int log4c_category_is_priority_enabled (const log4c_category_t * a_category,
int a_priority)
[inline], [static]
Returns true if the chained priority of the log4c_category_t is equal to or higher than the priority you passed in. lowkey the main character of all the is_*_enabled girlies π
a_categoryβ thelog4c_category_tobjecta_priorityβ the priority to compare with.
Returns: whether logging is enable for this priority.
References: log4c_category_get_chainedpriority().
log4c_category_is_trace_enabled
int log4c_category_is_trace_enabled (const log4c_category_t * a_category)
[inline], [static]
Returns true if the category will log messages with priority LOG4C_PRIORITY_TRACE. π¦
a_categoryβ thelog4c_category_tobject
Returns: whether the category will log.
References: log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_TRACE.
log4c_category_is_warn_enabled
int log4c_category_is_warn_enabled (const log4c_category_t * a_category)
[inline], [static]
Returns true if the category will log messages with priority LOG4C_PRIORITY_WARN. β οΈ
a_categoryβ thelog4c_category_tobject
Returns: whether the category will log.
References: log4c_category_is_priority_enabled(), and LOG4C_PRIORITY_WARN.
log4c_category_list
int log4c_category_list (log4c_category_t ** a_cats, int a_ncats)
Fills in an array with the log4c categories. like a little category lineup, iconic π
a_catsβ array of categories that will be filleda_ncatsβ number of categories in the array
Returns: -1 if it fails, or the number of available categories in log4c.
log4c_category_log
LOG4C_INLINE void log4c_category_log (const log4c_category_t * a_category,
int a_priority, const char * a_format, ...)
[static]
Logs a message with the priority you specified. π
a_categoryβ thelog4c_category_tobjecta_priorityβ the priority of this log message.a_formatβ format specifier for the string to write in the log file....β the arguments fora_format
References: log4c_category_is_priority_enabled(), and log4c_category_log().
log4c_category_log_locinfo
LOG4C_INLINE void log4c_category_log_locinfo (const log4c_category_t *
a_category, const log4c_location_info_t * a_locinfo, int a_priority,
const char * a_format, ...)
[static]
Logs a message with the priority you specified plus a user location info. it's giving receipts with coordinates π
a_categoryβ thelog4c_category_tobjecta_locinfoβ a user location infoa_priorityβ the priority of this log message.a_formatβ format specifier for the string to write in the log file....β the arguments fora_format
References: log4c_category_is_priority_enabled(), and log4c_category_log_locinfo().
log4c_category_new
log4c_category_t * log4c_category_new (const char * a_name)
Constructor for a log4c_category_t. π£
a_nameβ the category name
Returns: a log4c_category object
β οΈ Warning: this method should not be called directly, no cap. You should use the log4c_category_get() method in order to preserve the categories hierarchy. don't be that girl who skips the hierarchy π
References: LOG4C_PRIORITY_NOTSET.
log4c_category_notice
LOG4C_INLINE void log4c_category_notice (const log4c_category_t *
a_category, const char * a_format, ...)
[static]
Logs a message with notice priority. π
a_categoryβ thelog4c_category_tobjecta_formatβ format specifier for the string to write in the log file....β the arguments fora_format
References: log4c_category_is_priority_enabled(), log4c_category_notice(), and LOG4C_PRIORITY_NOTICE.
log4c_category_print
void log4c_category_print (const log4c_category_t * a_category, FILE *
a_stream)
prints the log4c_category_t object on a stream. π¨οΈβ¨
a_categoryβ thelog4c_category_tobjecta_streamβ the stream
log4c_category_set_additivity
int log4c_category_set_additivity (log4c_category_t * a_category, int
a_additivity)
Sets a new additivity flag for this category. ποΈ
a_categoryβ thelog4c_category_tobjecta_additivityβ the new category additivity
Returns: the previous category additivity
log4c_category_set_appender
const struct __log4c_appender * log4c_category_set_appender
(log4c_category_t * this, log4c_appender_t * a_appender)
Sets a new appender for this category. π
a_categoryβ thelog4c_category_tobjecta_appenderβ the new category appender
Returns: the previous category appender
Todo: need multiple appenders per category π« (yes bestie, it's a documented todo, we're not making it up)
log4c_category_set_priority
int log4c_category_set_priority (log4c_category_t * a_category, int
a_priority)
Sets a new priority of this category. π
a_categoryβ thelog4c_category_tobjecta_priorityβ the new priority to set. UseLOG4C_PRIORITY_NOTSETto let the category use its parents priority as effective priority.
Returns: the previous category priority
References: LOG4C_PRIORITY_UNKNOWN.
log4c_category_warn
LOG4C_INLINE void log4c_category_warn (const log4c_category_t * a_category,
const char * a_format, ...)
[static]
Logs a message with warn priority. β οΈπ
a_categoryβ thelog4c_category_tobjecta_formatβ format specifier for the string to write in the log file....β the arguments fora_format
References: log4c_category_is_priority_enabled(), log4c_category_warn(), and LOG4C_PRIORITY_WARN.
β¨ Author β¨
Generated automatically by Doxygen for log4c from the source code. π€ (yes bestie, a robot wrote the credits, and honestly? it ate)
and that's a wrap on category.h(3) from log4c, Version 1.2.4 β slay, you read the whole thing ππ go log something iconic π¦β¨
π¦ 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