Added LFS_INFO, upgraded most LFS_DEBUG statements
This adds LFS_INFO and limits LFS_DEBUG to opt-in debug output. Note that while LFS_DEBUG seems to be only used in LFS_DEBUGRBYDBALANCE, it can also be useful for adding additional logging while debugging. Having separate levels here is useful for filtering. Users should be able to expect LFS_INFO output to not bog down a system, while LFS_DEBUG can be a free-for-all dumping ground of debug info. This also converges to the common 4 levels of logging found in other systems, which was an intentional non-goal, but it's interesting to see how each level serves a purpose.
This commit is contained in:
+11
@@ -35,6 +35,7 @@
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#if !defined(LFS_NO_DEBUG) || \
|
||||
!defined(LFS_NO_INFO) || \
|
||||
!defined(LFS_NO_WARN) || \
|
||||
!defined(LFS_NO_ERROR) || \
|
||||
defined(LFS_YES_TRACE)
|
||||
@@ -72,6 +73,16 @@ extern "C"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LFS_INFO
|
||||
#ifndef LFS_NO_INFO
|
||||
#define LFS_INFO_(fmt, ...) \
|
||||
printf("%s:%d:info: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define LFS_INFO(...) LFS_INFO_(__VA_ARGS__, "")
|
||||
#else
|
||||
#define LFS_INFO(...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LFS_WARN
|
||||
#ifndef LFS_NO_WARN
|
||||
#define LFS_WARN_(fmt, ...) \
|
||||
|
||||
Reference in New Issue
Block a user