diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/qntan/Log.h | 40 | ||||
| -rw-r--r-- | include/qntan/Qntan.h | 31 |
2 files changed, 71 insertions, 0 deletions
diff --git a/include/qntan/Log.h b/include/qntan/Log.h new file mode 100644 index 0000000..87adba3 --- /dev/null +++ b/include/qntan/Log.h @@ -0,0 +1,40 @@ +#ifndef INCGUARD_A5xxH0Ai6CpNInqK +#define INCGUARD_A5xxH0Ai6CpNInqK + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifndef LOGF +# define LOGF(A, ...) if(A) (*(A))->fatal(A, __VA_ARGS__) +#endif + +#ifndef LOGE +# define LOGE(A, ...) if(A) (*(A))->error(A, __VA_ARGS__) +#endif + +#ifndef LOGW +# define LOGW(A, ...) if(A) (*(A))->warn(A, __VA_ARGS__) +#endif + +#ifndef LOGI +# define LOGI(A, ...) if(A) (*(A))->info(A, __VA_ARGS__) +#endif + +#ifndef LOGD +# define LOGD(A, ...) if(A) (*(A))->debug(A, __VA_ARGS__) +#endif + +#ifndef LOGT +# define LOGT(A, ...) if(A) (*(A))->trace(A, __VA_ARGS__) +#endif + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* INCGUARD_A5xxH0Ai6CpNInqK */ diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index 075c7f9..f28d19a 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -55,6 +55,7 @@ struct Qntan_Mallocator; struct Qntan_MemArena; struct Qntan_Executor; struct Qntan_Scheduler; +struct Qntan_Logger; struct Qntan_IoMux; struct Qntan_File; struct Qntan_FileSystem; @@ -258,6 +259,36 @@ struct Qntan_Scheduler { +struct Qntan_Logger { + /* Logger impls MUST prefer format specifiers that are specified in + * stdio printf and related functions. + * Logger impls SHOULD NOT implement format specifiers that could be + * confused by standard specifiers specified by stdio printf and + * related APIs. + */ + void (*fatal)( struct Qntan_Logger**, char const*fmt, ...); + /**/ + void (*error)( struct Qntan_Logger**, char const*fmt, ...); + /**/ + void (*warn)( struct Qntan_Logger**, char const*fmt, ...); + /**/ + void (*info)( struct Qntan_Logger**, char const*fmt, ...); + /**/ + void (*debug)( struct Qntan_Logger**, char const*fmt, ...); + /**/ + void (*trace)( struct Qntan_Logger**, char const*fmt, ...); + /**/ +}; + + + + + + + + + + struct Qntan_IoMux { /* An IO Multiplexer. * |
