mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-03-20 21:39:27 +00:00
44 lines
2.2 KiB
C
44 lines
2.2 KiB
C
/*
|
|
* logging utility
|
|
*
|
|
* (c) Adrian Smith 2012-2015, triode1@btinternet.com
|
|
* (c) Philippe 2016-2017, philippe_44@outlook.com
|
|
*
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#ifndef __LOG_UTIL_H
|
|
#define __LOG_UTIL_H
|
|
|
|
#include "platform.h"
|
|
|
|
typedef enum { lERROR = 0, lWARN, lINFO, lDEBUG, lSDEBUG } log_level;
|
|
|
|
const char* logtime(void);
|
|
void logprint(const char* fmt, ...);
|
|
log_level debug2level(char* level);
|
|
char* level2debug(log_level level);
|
|
|
|
#define LOG_ERROR(fmt, ...) logprint("%s %s:%d " fmt "\n", logtime(), __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
#define LOG_WARN(fmt, ...) \
|
|
if(*loglevel >= lWARN) logprint("%s %s:%d " fmt "\n", logtime(), __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
#define LOG_INFO(fmt, ...) \
|
|
if(*loglevel >= lINFO) logprint("%s %s:%d " fmt "\n", logtime(), __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
#define LOG_DEBUG(fmt, ...) \
|
|
if(*loglevel >= lDEBUG) logprint("%s %s:%d " fmt "\n", logtime(), __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
#define LOG_SDEBUG(fmt, ...) \
|
|
if(*loglevel >= lSDEBUG) logprint("%s %s:%d " fmt "\n", logtime(), __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
|
|
|
#endif |