layout.h(3)
π layout.h β the manual page, but make it cute π
ok so bestie, this is layout.h(3) from the Library Functions Manual, and it's literally the whole interface for making your log events look however you want them to look. your logs? your aesthetic. periodt. β¨
πΈ NAME πΈ
layout.h β the interface for user-specific layout formats for log4c_logging_event events. that's it, that's the girl. π
π¦ SYNOPSIS π¦
#include <log4c/defs.h>
#include <log4c/logging_event.h>
#include <stdio.h>
π Data Structures
struct log4c_layout_typeβ the log4c layout type class, aka the blueprint of the vibe π«Ά
π Macros
#define log4c_layout_type_define(a_type)β a little macro moment, more on her below
π Typedefs
typedef struct __log4c_layout log4c_layout_ttypedef struct log4c_layout_type log4c_layout_type_tβ the log4c layout type class
π Functions
const log4c_layout_type_t * log4c_layout_type_get (const char *a_name)
const log4c_layout_type_t * log4c_layout_type_set (const
log4c_layout_type_t *a_type)
log4c_layout_t * log4c_layout_get (const char *a_name)
log4c_layout_t * log4c_layout_new (const char *a_name)
void log4c_layout_delete (log4c_layout_t *a_layout)
const char * log4c_layout_get_name (const log4c_layout_t *a_layout)
const log4c_layout_type_t * log4c_layout_get_type (const log4c_layout_t
*a_layout)
const log4c_layout_type_t * log4c_layout_set_type (log4c_layout_t
*a_layout, const log4c_layout_type_t *a_type)
void * log4c_layout_get_udata (const log4c_layout_t *a_layout)
void * log4c_layout_set_udata (log4c_layout_t *a_layout, void *a_udata)
const char * log4c_layout_format (const log4c_layout_t *a_layout, const
log4c_logging_event_t *a_event)
void log4c_layout_print (const log4c_layout_t *a_layout, FILE *a_stream)
void log4c_layout_types_free (void)
void log4c_layout_types_print (FILE *fp)
π Detailed Description π
so basically: this is the interface for user-specific layout formats for log4c_logging_event events. you want your logs to hit different? this is where you do that. π
Todo β the layout interface needs a better configuration system depending on the layout type. the udata field is a just a trick. π
Todo β a pattern layout would be welcomed !! not me begging for features in the docs fr fr π
β¨ Macro Definition Documentation β¨
#define log4c_layout_type_define( a_type)
a lil helper macro to define static layout types. she's helpful, she's tiny, she's doing her best. π§
Parameters
a_typeβ thelog4c_layout_type_tobject to define
Warning β needs GCC support, otherwise this macro does literally nothing. no cap. π
Deprecated β this macro, and the static initialization of layouts in general, is deprecated. instead, use thelog4c_layout_type_set()function to initialize your appenders before callinglog4c_init(). i'm being so serious, don't use the old way bestie π
π Typedef Documentation π
typedef struct __log4c_layout log4c_layout_t
the log4c layout class. iconic behavior. π
typedef struct log4c_layout_type log4c_layout_type_t
the log4c layout type class. her attributes description is:
nameβ layout type nameformat
π₯ Function Documentation π₯
void log4c_layout_delete (log4c_layout_t * a_layout)
the destructor for a layout. she's leaving, say bye. π
const char * log4c_layout_format (const log4c_layout_t * a_layout, const log4c_logging_event_t * a_event)
formats a log4c_logging_event events into a string. yes, that's the actual grammar in the docs, and honestly? relatable. π
Parameters
a_layoutβ thelog4c_layout_tobjecta_eventβ alogging_event_tobject
Returns
an appendable string. slay. β¨
log4c_layout_t * log4c_layout_get (const char * a_name)
gets a pointer to an existing layout.
Parameters
a_nameβ the name of the layout to return.
Returns
a pointer to an existing layout, or NULL if no layout with the specfied name exists. (that typo is in the original, i'm preserving her, she's part of history π«Ά)
const char * log4c_layout_get_name (const log4c_layout_t * a_layout)
Parameters
a_layoutβ thelog4c_layout_tobject
Returns
the layout name. cute, short, to the point. π
const log4c_layout_type_t * log4c_layout_get_type (const log4c_layout_t * a_layout)
Parameters
a_layoutβ thelog4c_layout_tobject
Returns
a log4c_layout_type_t object. π
void * log4c_layout_get_udata (const log4c_layout_t * a_layout)
Parameters
a_layoutβ thelog4c_layout_tobject
Returns
the layout user data. π«
log4c_layout_t * log4c_layout_new (const char * a_name)
the constructor for a layout. brand new baby layout, welcome to the world π
void log4c_layout_print (const log4c_layout_t * a_layout, FILE * a_stream)
prints the layout on a stream.
Parameters
a_layoutβ thelog4c_layout_tobjecta_streamβ the stream
const log4c_layout_type_t * log4c_layout_set_type (log4c_layout_t * a_layout, const log4c_layout_type_t * a_type)
sets the layout type.
Parameters
a_layoutβ thelog4c_layout_tobjecta_typeβ the new layout type
Returns
the previous layout type. she remembers what you had before, she's not judging π«Ά
void * log4c_layout_set_udata (log4c_layout_t * a_layout, void * a_udata)
sets the layout user data.
Parameters
a_layoutβ thelog4c_layout_tobjecta_udataβ the new layout user data
Returns
the previous layout user data. history! preserved! πβ¨
const log4c_layout_type_t * log4c_layout_type_get (const char * a_name)
gets a pointer to an existing layout type.
Parameters
a_nameβ the name of the layout type to return.
Returns
a pointer to an existing layout type, or NULL if no layout type with the specified name exists.
const log4c_layout_type_t * log4c_layout_type_set (const log4c_layout_type_t * a_type)
ok this one is important bestie, listen up. π use this function to register a layout type with log4c. once this is done you may refer to this type by name both programatically and in the log4c configuration file. it's giving main character energy.
Parameters
a_typeβ a pointer to the new layout type to set.
Returns
a pointer to the previous layout type of same name.
Example code fragment:
const log4c_layout_type_t log4c_layout_type_xml = {
"s13_xml",
xml_format,
};
log4c_layout_type_set(&log4c_layout_type_xml);
void log4c_layout_types_free (void )
free all layout types. everybody go home, the party's over π
void log4c_layout_types_print (FILE * fp)
prints all the current registered layout types on a stream.
Parameters
fpβ the stream
π«Ά Author π«Ά
Generated automatically by Doxygen for log4c from the source code. (not a human author, just a robot doing her best β¨)
and that's the whole page bestie!! π this was log4c Version 1.2.4, dated with the manual page layout.h(3) β mwah, go forth and format your logs gorgeously. π¦πΈπ
π¦ 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