Cthulhu  0.2.10
Cthulhu compiler collection
log.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-only
2 
3 #pragma once
4 
5 #include <ctu_base_api.h>
6 
7 #include "core/compiler.h"
8 #include "core/analyze.h"
9 
10 #include <stdarg.h>
11 #include <stdbool.h>
12 
14 
19 
21 typedef void (*verbose_t)(const char *fmt, va_list args);
22 
24 CT_BASE_API extern verbose_t gVerboseCallback;
25 
29 CT_BASE_API void ctu_log_update(bool enable);
30 
34 CT_BASE_API bool ctu_log_enabled(void);
35 
40 STA_PRINTF(1, 2)
41 CT_BASE_API void ctu_log(STA_FORMAT_STRING const char *fmt, ...);
42 
47 CT_BASE_API void ctu_vlog(IN_STRING const char *fmt, va_list args);
48 
50 
#define STA_PRINTF(a, b)
mark a function as a printf style function
Definition: analyze.h:165
#define STA_FORMAT_STRING
mark a function parameter as a printf format string
#define IN_STRING
annotate a parameter as being a null terminated string
#define CT_BEGIN_API
Definition: compiler.h:129
#define CT_END_API
Definition: compiler.h:130
CT_BASE_API void ctu_log(STA_FORMAT_STRING const char *fmt,...)
log a message
CT_BASE_API verbose_t gVerboseCallback
the global verbose logging callback
Definition: log.c:12
CT_BASE_API void ctu_vlog(const char *fmt, va_list args)
log a message
Definition: log.c:37
CT_BASE_API void ctu_log_update(bool enable)
update the verbosity of the logging system
Definition: log.c:15
CT_BASE_API bool ctu_log_enabled(void)
check if verbose logging is enabled
Definition: log.c:20
void(* verbose_t)(const char *fmt, va_list args)
a logging callback
Definition: log.h:21
CT_NODISCARD STA_FORMAT_STRING const char * fmt
Definition: str.h:68