/* * logger - un loggeur * Copyright (C) 2024 Valentin Moguérou * * 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 . */ #ifndef LOGGER_H_INCLUDED #define LOGGER_H_INCLUDED #include #include #include enum LogLevel { LOG_PANIC=6, LOG_FATAL=5, LOG_ERROR=4, LOG_WARN=3, LOG_INFO=2, LOG_DEBUG=1, LOG_TRACE=0 }; typedef enum LogLevel LogLevel; struct Logger { clock_t t0; LogLevel level; FILE* logfile; }; typedef struct Logger* Logger; extern Logger logger; void create_logger(char *logpath, LogLevel level); void destroy_logger(); void panic(char *str, ...); void fatal(char *str, ...); void error(char *str, ...); void warn(char *str, ...); void info(char *str, ...); void debug(char *str, ...); void trace(char *str, ...); #endif