#pragma once

#include <stdbool.h>

typedef enum {
    PXL8_LOG_LEVEL_TRACE = 0,
    PXL8_LOG_LEVEL_DEBUG = 1,
    PXL8_LOG_LEVEL_INFO = 2,
    PXL8_LOG_LEVEL_WARN = 3,
    PXL8_LOG_LEVEL_ERROR = 4,
} pxl8_log_level;

typedef struct pxl8_log {
    pxl8_log_level level;
} pxl8_log;

void pxl8_log_init(pxl8_log* log);
void pxl8_log_set_level(pxl8_log_level level);

void pxl8_log_write_trace(const char* file, int line, const char* fmt, ...);
void pxl8_log_write_debug(const char* file, int line, const char* fmt, ...);
void pxl8_log_write_info(const char* fmt, ...);
void pxl8_log_write_warn(const char* file, int line, const char* fmt, ...);
void pxl8_log_write_error(const char* file, int line, const char* fmt, ...);

#define pxl8_trace(...) pxl8_log_write_trace(__FILE__, __LINE__, __VA_ARGS__)
#define pxl8_debug(...) pxl8_log_write_debug(__FILE__, __LINE__, __VA_ARGS__)
#define pxl8_info(...) pxl8_log_write_info(__VA_ARGS__)
#define pxl8_warn(...) pxl8_log_write_warn(__FILE__, __LINE__, __VA_ARGS__)
#define pxl8_error(...) pxl8_log_write_error(__FILE__, __LINE__, __VA_ARGS__)
#define pxl8_script_error(...) pxl8_log_write_error(NULL, 0, __VA_ARGS__)
