From 31e00a3697cdebc36395411f17655a729395033c Mon Sep 17 00:00:00 2001 From: andreas Date: Sat, 27 Jun 2026 17:42:30 +0200 Subject: Introduce LoggerFactory --- include/qntan/Qntan.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index ea35e70..e159546 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -66,6 +66,7 @@ struct Qntan_MemArena; struct Qntan_Executor; struct Qntan_Scheduler; struct Qntan_Logger; +struct Qntan_LoggerFactory; struct Qntan_IoMux; struct Qntan_File; struct Qntan_FileSystem_Dirent; @@ -365,6 +366,34 @@ struct Qntan_Logger { +#ifndef Qntan_LoggerFactory_getLogger +# define Qntan_LoggerFactory_getLogger(A, B) (*A)->getLogger(A, B) +#endif + +struct Qntan_LoggerFactory { + /* TODO: Clarify resource responsibilities: For how long is the + * returned logger valid? What happens if called twice? How to + * `unref()` a logger we got? ... + */ + struct Qntan_Logger**(*getLogger)( struct Qntan_LoggerFactory**, char const*name ); + /* A ZERO-TERMINATED identifier identifying the requested logger. + * Usually this should be an unique, short, printable name. Eg + * "LibFoo/ItemProcessor", "LibBar/CustomerService" or whatever. + * This is solely an indicator for the implementation so it can + * categorize/group/manage loggers. An impl may also decide to just + * completely ignore the given hint. + */ +}; + + + + + + + + + + #ifndef Qntan_IoMux_read # define Qntan_IoMux_read(A, B, C, D, E, F, G) (*A)->read(A, B, C, D, E, F, G) #endif -- cgit v1.3.1