lfs_log.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Joshua DeWeese <josh.deweese@gmail.com>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
9 #pragma once
10 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include "log.h"
31 
32 #ifdef LFS_YES_TRACE
33 # define ENABLE_DEBUG 1
34 #endif
35 #include "debug.h"
36 
43 #define _LFS_TRACE(fmt, ...) \
44  DEBUG("%s:%d: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
45 
53 #define _LFS_LOG(level, fmt, ...)\
54  LOG(level, "lfs: " fmt "%s\n", __VA_ARGS__)
55 
64 #ifdef LFS_YES_TRACE
65 # define LFS_TRACE(...) _LFS_TRACE(__VA_ARGS__, "")
66 #else
67 # define LFS_TRACE(...)
68 #endif
69 
71 #ifndef LFS_NO_DEBUG
72 # define LFS_DEBUG(...) _LFS_LOG(LOG_DEBUG, __VA_ARGS__, "")
73 #else
74 # define LFS_DEBUG(...)
75 #endif
76 
78 #ifndef LFS_NO_WARN
79 # define LFS_WARN(...) _LFS_LOG(LOG_WARNING, __VA_ARGS__, "")
80 #else
81 # define LFS_WARN(...)
82 #endif
83 
85 #ifndef LFS_NO_ERROR
86 # define LFS_ERROR(...) _LFS_LOG(LOG_ERROR, __VA_ARGS__, "")
87 #else
88 # define LFS_ERROR(...)
89 #endif
90 
Debug-header.