101typedef struct vl_log_sink_vtbl_
110 void (*write)(
void* sink_data,
const char* msg, vl_memsize_t len);
117 void (*flush)(
void* sink_data);
126 void (*destroy)(
void* sink_data);
147typedef struct vl_log_sink_
171typedef struct vl_log_config_
429VL_API
void vlLogErrorF(
const char* msgFormat, ...);
473#ifndef VL_ENABLE_DEBUG_LOG
475#define VL_ENABLE_DEBUG_LOG 1
477#define VL_ENABLE_DEBUG_LOG 0
481#if VL_ENABLE_DEBUG_LOG
489#define VL_LOGD_MSG0(msg) \
490 vlLogMessageF(VL_ANSI_FG_MAGENTA "[DBG | %s @ line %d] " VL_ANSI_RESET "%s", __FILE__, __LINE__, msg)
496#define VL_LOGD_MSGF(fmt, ...) \
497 vlLogMessageF(VL_ANSI_FG_MAGENTA "[DBG | %s @ line %d] " VL_ANSI_RESET fmt, __FILE__, __LINE__, __VA_ARGS__)
503#define VL_LOGD_ERR0(msg) \
504 vlLogErrorF(VL_ANSI_FG_YELLOW "[DBG | %s @ line %d] " VL_ANSI_RESET "%s", __FILE__, __LINE__, msg)
510#define VL_LOGD_ERRF(fmt, ...) \
511 vlLogErrorF(VL_ANSI_FG_YELLOW "[DBG | %s @ line %d] " VL_ANSI_RESET fmt, __FILE__, __LINE__, __VA_ARGS__)
513#define VL_LOGD_MSG0(msg) ((void)0)
514#define VL_LOGD_MSGF(fmt, ...) ((void)0)
515#define VL_LOGD_ERR0(msg) ((void)0)
516#define VL_LOGD_ERRF(fmt, ...) ((void)0)
523#define VL_LOG_MSG0(msg) vlLogMessage(msg)
529#define VL_LOG_MSGF(fmt, ...) vlLogMessageF((fmt), __VA_ARGS__)
535#define VL_LOG_ERR0(msg) vlLogError(msg)
541#define VL_LOG_ERRF(fmt, ...) vlLogErrorF((fmt), __VA_ARGS__)
Virtual function table for a log sink.
Definition vl_log.h:102
Opaque logger instance type.
Definition vl_log.c:28
VL_API void vlLogFlush(void)
Flush the global logger.
Definition vl_log.c:457
VL_API void vlLoggerMessage(vl_logger *logger, const char *msg)
Write a preformatted message through a specific logger.
Definition vl_log.c:331
VL_API vl_log_sink vlLogSinkStream(vl_stream *stream)
Create a sink that writes to an existing vl_stream.
Definition vl_log.c:422
void * sink_data
Sink implementation state.
Definition vl_log.h:161
const vl_log_sink_vtbl * vtbl
Sink callback table.
Definition vl_log.h:154
VL_API void vlLoggerDelete(vl_logger *logger)
Destroy a logger instance and release all associated resources.
Definition vl_log.c:272
VL_API void vlLoggerMessageF(vl_logger *logger, const char *msgFormat,...)
Write a formatted message through a specific logger.
Definition vl_log.c:350
VL_API void vlLogMessageF(const char *msgFormat,...)
Write a formatted message through the global logger.
Definition vl_log.c:487
VL_API vl_bool_t vlLogAddStdoutSink(void)
Convenience helper that attaches a stdout sink to the global logger.
Definition vl_log.c:476
VL_API void vlLogInit(const vl_log_config *config)
Initialize the global logger.
Definition vl_log.c:447
VL_API vl_bool_t vlLogAddStreamSink(vl_stream *stream)
Convenience helper that attaches a vl_stream sink to the global logger.
Definition vl_log.c:478
vl_bool_t async
Enable asynchronous logging.
Definition vl_log.h:185
VL_API void vlLogError(const char *msg)
Write an error message through the global logger.
Definition vl_log.c:507
VL_API void vlLogShutdown(void)
Shut down and destroy the global logger.
Definition vl_log.c:459
VL_API vl_logger * vlLoggerNew(const vl_log_config *config)
Create a new logger instance.
Definition vl_log.c:246
VL_API void vlLogErrorF(const char *msgFormat,...)
Write a formatted error message through the global logger.
Definition vl_log.c:509
VL_API vl_bool_t vlLogAddSink(vl_log_sink sink)
Attach a sink to the global logger.
Definition vl_log.c:467
VL_API void vlLoggerFlush(vl_logger *logger)
Flush pending messages for a specific logger.
Definition vl_log.c:368
VL_API void vlLogMessage(const char *msg)
Write a preformatted message through the global logger.
Definition vl_log.c:480
VL_API vl_log_sink vlLogSinkStdout(void)
Create a sink that writes to standard output.
Definition vl_log.c:405
VL_API vl_bool_t vlLoggerAddSink(vl_logger *logger, vl_log_sink sink)
Attach a sink to a logger instance.
Definition vl_log.c:309
Configuration used when creating a logger.
Definition vl_log.h:172
Public descriptor for attaching an output sink to a logger.
Definition vl_log.h:148
VL_BOOL_T vl_bool_t
Definition vl_numtypes.h:191
Generic, thread-safe byte stream abstraction.
Definition vl_stream.h:77