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 
24 #ifndef LFS_LOG_H
25 #define LFS_LOG_H
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include "log.h"
32 
33 #ifdef LFS_YES_TRACE
34 # define ENABLE_DEBUG 1
35 #endif
36 #include "debug.h"
37 
44 #define _LFS_TRACE(fmt, ...) \
45  DEBUG("%s:%d: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
46 
54 #define _LFS_LOG(level, fmt, ...)\
55  LOG(level, "lfs: " fmt "%s\n", __VA_ARGS__)
56 
65 #ifdef LFS_YES_TRACE
66 # define LFS_TRACE(...) _LFS_TRACE(__VA_ARGS__, "")
67 #else
68 # define LFS_TRACE(...)
69 #endif
70 
72 #ifndef LFS_NO_DEBUG
73 # define LFS_DEBUG(...) _LFS_LOG(LOG_DEBUG, __VA_ARGS__, "")
74 #else
75 # define LFS_DEBUG(...)
76 #endif
77 
79 #ifndef LFS_NO_WARN
80 # define LFS_WARN(...) _LFS_LOG(LOG_WARNING, __VA_ARGS__, "")
81 #else
82 # define LFS_WARN(...)
83 #endif
84 
86 #ifndef LFS_NO_ERROR
87 # define LFS_ERROR(...) _LFS_LOG(LOG_ERROR, __VA_ARGS__, "")
88 #else
89 # define LFS_ERROR(...)
90 #endif
91 
94 #endif /* LFS_LOG_H */
Debug-header.