Skip to content

LeaoMartelo2/LogNest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LogNest

A Simple yet customizable header only library for logging in C.

image Image depicting the dafault configuration result

Installing:

wget https://raw.githubusercontent.com/LeaoMartelo2/LogNest/main/lognest.h

just copy this if you are lazy

Usage:

(Please refer to the examples if needed)

  • Download lognest.h and add it to your project.
  • Any specific log level can be disabled with:
#define LOGNEST_DISABLE_<TRACE/WARN/ERROR/DEBUG>
  • Change the log type indicator 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 is sent to (default: "latest.log") with:

#define LOGNEST_FILE "path/to/log/filename.log"
  • Optionally disable the log's time or date of the message with:
#define LOGNEST_DISABLE_TIMESTAMP
/* or */
#define LOGNEST_DISABLE_DATESTAMP
  • Optionally allow crashing on error with:
#define LOGNEST_ALLOW_CRASH

(All configuration defines must come before the implementation define)

  • For the library to serve as implementation, add: #define LOGNEST_IMPLEMENTATION before finally #include-ing the file.
  • Only add the Implementation define to a single file, adding the .h to multiple files is ok.

image

Latest update changes:

LogNest 2.1.5

  • Added LOGNEST_API macro (defaulted to static inline) to allow you to change how lognest functions are defined.

  • Added macros do change the prefix of the log level identifier, add this before the implementation define:

#define LOGNEST_<TRACE/WARN/ERROR/DEBUG>_PREFIX "<custom prefix goes here>"
  • Added split the macro to divide the timestamp do allow to individually disable the date-stamp with #define LOGNEST_DISABLE_DATESTAMP
  • Renamed some internal macros with common names to avoid name hogging.
  • Added a option to allow crashing on error:
#define LOGNEST_ALLOW_CRASH

About

Simple header file only library in C to easily make log files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages