/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef PPM_UTIL_LOG_H
#define PPM_UTIL_LOG_H

#include <stdarg.h>

typedef enum ppm_log_level {
    PPM_LOG_ERROR = 0,
    PPM_LOG_WARN  = 1,
    PPM_LOG_INFO  = 2,
    PPM_LOG_DEBUG = 3,
    PPM_LOG_TRACE = 4,
} ppm_log_level_t;

void ppm_log_set_level(ppm_log_level_t level);
void ppm_log_set_color(int enabled);

void ppm_log(ppm_log_level_t level, const char *fmt, ...)
    __attribute__((format(printf, 2, 3)));

#define ppm_error(...) ppm_log(PPM_LOG_ERROR, __VA_ARGS__)
#define ppm_warn(...)  ppm_log(PPM_LOG_WARN,  __VA_ARGS__)
#define ppm_info(...)  ppm_log(PPM_LOG_INFO,  __VA_ARGS__)
#define ppm_debug(...) ppm_log(PPM_LOG_DEBUG, __VA_ARGS__)
#define ppm_trace(...) ppm_log(PPM_LOG_TRACE, __VA_ARGS__)

#endif /* PPM_UTIL_LOG_H */
