Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.
/ loggen Public archive

Simple category-based logger generator for C/C++

License

Notifications You must be signed in to change notification settings

MetricPanda/loggen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loggen

Simple category-based logger generator for C/C++.

int main()
{
  GlobalVerbosity = LOG_EVERYTHING;
  Log(VERBOSE|PLATFORM, "Startup");
  Log(INFO|VIDEO, "Video init");
  Log(AUDIO|ERROR|INIT, "Fatal error");
}

Will output:

[VERBOSE][PLATFORM][          ]  test/demo.c:   9 Startup
[INFO   ][VIDEO   ][          ]  test/demo.c:  10 Video init
[ERROR  ][AUDIO   ][INIT      ]  test/demo.c:  11 Fatal error

For more information see the accompaning blog post: Category-based logging using bit masks.

Usage

  • Edit the main() function and add the log categories and labels you wish to use.
  • Build with make or compile with a GNU C99 supporting compiler
  • Run the loggen executable and redirect the output to a blank file like so: ./loggen > logger.h
  • Include logger.h in your source tree and use the Log macro

License

Public Domain

About

Simple category-based logger generator for C/C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published