Skip to content

LeaoMartelo2/LogNest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LogNest

A "Header file only" library for logging to files made in C, with focus on simplicity

image

Installing:

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

just copy this if you are lazy

Usage:

  • Download lognest.h and add it to your project.
  • Any specific log level can be disabled with:
#define LOGNEST_DISABLE_TRACE
#define LOGNEST_DISABLE_WARN
#define LOGNEST_DISABLE_ERROR
#define LOGNEST_DISABLE_DEBUG
  • 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 timestamp with:
#define LOGNEST_DISABLE_TIMESTAMP

(All configuration defines must come before the implementation define)

  • For the library to serve as implementation, add: #define LOGNEST_IMPLEMENTATION before the #include.
  • This also means you should only define the implementation in one file. Just including it serves as a header.

image

Updates:

LogNest 2.1 (August 1st, 2025)

  • Renamed some internal functions to avoid name hogging.
  • Added the ability to disable the Timestamp on logging.

use:

#define LOGNEST_DISABLE_TIMESTAMP

before defining the implementation.

  • Fixed some UX around changing the file being logged to.

you can now do:

#define LOGNEST_FILE "path/to/log/filename.log"

before defining the implementation

LogNest 2.0 (May 7th, 2025)

  • Improved compiler compatibility by removing some parts of the code that i didn't knew were GNU extensions.

  • Added new Macros for disabling a log level entirely

you can now disable any log level with:

#define LOGNEST_DISABLE_TRACE
#define LOGNEST_DISABLE_WARN
#define LOGNEST_DISABLE_ERROR
#define LOGNEST_DISABLE_DEBUG

That has to be defined before the implementation define, that is already before the #include

  • Added a new macro that returns a c literal of the current LogNest version

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages