appender.h(3)
π appender.h π
Library Functions Manual Β· section 3 Β· the whole vibe is: implement this interface for your own strategies for printing log statements. π
Like, it's a header. It's the appender header. And it's lowkey the moment where log4c hands you the aux cord and says "okay bestie, you pick how the logs get printed." π
πΈ NAME πΈ
appender.h β Implement this interface for your own strategies for printing log statements.
β¨ SYNOPSIS β¨
#include <log4c/defs.h>
#include <log4c/layout.h>
#include <stdio.h>
π Data Structures π
struct log4c_appender_typeβ log4c appender type class
π§ Macros π§
#define log4c_appender_type_define(a_type)
π¦ Typedefs π¦
typedef struct __log4c_appender log4c_appender_ttypedef struct log4c_appender_type log4c_appender_type_tβ log4c appender type class
π Functions π
const log4c_appender_type_t * log4c_appender_type_get (const char *a_name)
const log4c_appender_type_t * log4c_appender_type_set (const log4c_appender_type_t *a_type)
log4c_appender_t * log4c_appender_get (const char *a_name)
log4c_appender_t * log4c_appender_new (const char *a_name)
void log4c_appender_delete (log4c_appender_t *a_appender)
const char * log4c_appender_get_name (const log4c_appender_t *a_appender)
const log4c_appender_type_t * log4c_appender_get_type (const log4c_appender_t *a_appender)
const log4c_layout_t * log4c_appender_get_layout (const log4c_appender_t *a_appender)
void * log4c_appender_get_udata (const log4c_appender_t *a_appender)
const log4c_appender_type_t * log4c_appender_set_type (log4c_appender_t *a_appender, const log4c_appender_type_t *a_type)
void * log4c_appender_set_udata (log4c_appender_t *a_appender, void *a_udata)
const log4c_layout_t * log4c_appender_set_layout (log4c_appender_t *a_appender, const log4c_layout_t *a_layout)
int log4c_appender_open (log4c_appender_t *a_appender)
int log4c_appender_append (log4c_appender_t *a_appender, log4c_logging_event_t *a_event)
int log4c_appender_close (log4c_appender_t *a_appender)
void log4c_appender_print (const log4c_appender_t *a_appender, FILE *a_stream)
void log4c_appender_types_free (void)
void log4c_appender_types_print (FILE *fp)
π«Ά Detailed Description π«Ά
Implement this interface for your own strategies for printing log statements.
Todo π β the appender interface needs a better configuration system depending on the layout type. The udata field is a just a trick.
ngl that "just a trick" line is giving "we did what we had to do" energy and honestly? respect. π
π Macro Definition Documentation π
#define log4c_appender_type_define( a_type)
Helper macro to define static appender types.
- Parameters
a_typeβ thelog4c_appender_type_tobject to define
Warning β οΈ β needs GCC support: otherwise this macro does nothing
Deprecated π β This macro, and the static initialialization of appenders in general, is deprecated. Use rather thelog4c_appender_type_set()function to initialize your appenders before callinglog4c_init()
periodt. if you were reaching for this macro, bestie, put it down gently and use log4c_appender_type_set() instead. π
π Typedef Documentation π
typedef struct __log4c_appender log4c_appender_t
log4c appender class
typedef struct log4c_appender_type log4c_appender_type_t
log4c appender type class Attributes description:
nameβ appender type nameopenappendclose
π Function Documentation π
int log4c_appender_append (log4c_appender_t * this, log4c_logging_event_t * a_event)
log in appender specific way.
- Parameters
a_appenderβ thelog4c_appenderobjecta_eventβ thelog4c_logging_event_tobject to log.
Bug π β is this the right place to open an appender ?
not the source code asking the hard questions π iconic honestly
int log4c_appender_close (log4c_appender_t * a_appender)
closes the appender
- Parameters
a_appenderβ thelog4c_appender_tobject
- Returns β zero if successful,
-1otherwise
void log4c_appender_delete (log4c_appender_t * a_appender)
Destructor for log4c_appender_t.
log4c_appender_t * log4c_appender_get (const char * a_name)
Get a pointer to an existing appender.
- Parameters
a_nameβ the name of the appender to return.
- Returns β a pointer to an existing appender, or
NULLif no appender with the specfied name exists.
const log4c_layout_t * log4c_appender_get_layout (const log4c_appender_t * a_appender)
- Parameters
a_appenderβ thelog4c_appender_tobject
- Returns β the appender layout
const char * log4c_appender_get_name (const log4c_appender_t * a_appender)
- Parameters
a_appenderβ thelog4c_appender_tobject
- Returns β the appender name
const log4c_appender_type_t * log4c_appender_get_type (const log4c_appender_t * a_appender)
- Parameters
a_appenderβ thelog4c_appender_tobject
- Returns β the appender operations
void * log4c_appender_get_udata (const log4c_appender_t * a_appender)
- Parameters
a_appenderβ thelog4c_appender_tobject
- Returns β the appender user data
log4c_appender_t * log4c_appender_new (const char * a_name)
Constructor for log4c_appender_t.
int log4c_appender_open (log4c_appender_t * a_appender)
opens the appender.
- Parameters
a_appenderβ thelog4c_appender_tobject
void log4c_appender_print (const log4c_appender_t * a_appender, FILE * a_stream)
prints the appender on a stream
- Parameters
a_appenderβ thelog4c_appender_tobjecta_streamβ the stream
const log4c_layout_t * log4c_appender_set_layout (log4c_appender_t * a_appender, const log4c_layout_t * a_layout)
sets the appender layout
- Parameters
a_appenderβ thelog4c_appender_tobjecta_layoutβ the new appender layout
- Returns β the previous appender layout
const log4c_appender_type_t * log4c_appender_set_type (log4c_appender_t * a_appender, const log4c_appender_type_t * a_type)
sets the appender type
- Parameters
a_appenderβ thelog4c_appender_tobjecta_typeβ the new appender type
- Returns β the previous appender type
void * log4c_appender_set_udata (log4c_appender_t * a_appender, void * a_udata)
sets the appender user data
- Parameters
a_appenderβ thelog4c_appender_tobjecta_udataβ the new appender user data
- Returns β the previous appender user data
const log4c_appender_type_t * log4c_appender_type_get (const char * a_name)
Get a pointer to an existing appender type.
- Parameters
a_nameβ the name of the appender type to return.
- Returns β a pointer to an existing appender type, or
NULLif no appender type with the specified name exists.
const log4c_appender_type_t * log4c_appender_type_set (const log4c_appender_type_t * a_type)
Use this function to register an appender 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 appender type to set.
- Returns β a pointer to the previous appender type of same name.
Example code fragment:
const log4c_appender_type_t log4c_appender_type_s13_file = {
"s13_file",
s13_file_open,
s13_file_append,
s13_file_close,
};
log4c_appender_type_set(&log4c_appender_type_s13_file);
okay this is literally the main character move of the whole page, register your type, get called by name in the config file, slay. π
void log4c_appender_types_free (void )
free all appender types
void log4c_appender_types_print (FILE * fp)
prints all the current registered appender types on a stream
- Parameters
fpβ the stream
π Author π
Generated automatically by Doxygen for log4c from the source code.
and that's the whole page bestie!! π this was log4c Version 1.2.4, page appender.h(3), and it was auto-generated by Doxygen from the source code, so be nice to it, it didn't choose its own formatting. π¦β¨ byeee π«Ά
π¦ 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