/* logger.h * * Copyright 2025 Francois Techene * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef LOGGER_H #define LOGGER_H typedef enum { NONE_LEVEL = 0, ERROR_LEVEL, WARNING_LEVEL, INFO_LEVEL, DEBUG_LEVEL } LogLevel; typedef enum { NONE_OUT = 0, CONSOLE_OUT, FILE_OUT } LogOutputMethod; typedef struct _Logger { void (*log) (char* format, ...); void (*debug) (char* format, ...); void (*info) (char* format, ...); void (*warn) (char* format, ...); void (*error) (char* format, ...); char* file_path; int output_method; int log_level; } Logger; extern Logger logger; void init_logger(LogLevel level, LogOutputMethod out, char* file_path); void log_debug(char* format, ...); void log_info(char* format, ...); void log_warn(char* format, ...); void log_error(char* format, ...); void log_to_none(char* format, ...); void log_to_console(char* format, ...); void log_to_file(char* format, ...); #endif