Image depicting the dafault configuration result
Note
This is a macro heavy library, do of that what you will.
wget https://raw.githubusercontent.com/LeaoMartelo2/LogNest/main/lognest.h
just copy this if you are lazy
(Please refer to the examples if needed)
- Download
lognest.hand add it to your project. #definethe settings for your program ONLY in one file.- Add
#define LOGNEST_IMPLEMENTATIONbefore including it ONLY in one file (the same you configured on). #includelognest.h normally and in any other file you need.
- Disable any specific log level with:
#define LOGNEST_DISABLE_<TRACE/WARN/ERROR/DEBUG>Pairs great with -DLOGNEST_DISABLE_ on compile flags
- Change any log level identifier prefix with :
#define LOGNEST_<TRACE/WARN/ERROR/DEBUG>_PREFIX "<custom prefix>" The separators ([]) around the type must also be included here.
- Optionally change where the log file path with:
#define LOGNEST_FILE "path/to/log/filename.log" Defaults to latest.log
- Optionally disable the log's time or date of message with:
#define LOGNEST_DISABLE_TIMESTAMP
/* or */
#define LOGNEST_DISABLE_DATESTAMP- Optionally allow crashing on error with:
#define LOGNEST_ALLOW_CRASH- Some other misc configurations can be changed with:
#define LOGNEST_ABORT()
/* uses stdlib's abort() for crashing */
#define LOGNEST_API
/* added before every function definition, use it to add stuff like `static inline` on single file projects */- Fix issue with
LOGNEST_APImacro causing some issues with its defult behaviour, now its up to the user to enable it. - Add macro to replace force exiting / crashing on error function with your own.