Skip to content

Reneisda/clog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

C-Logger clog

c stb-style header-only library for logging

Logging is added pre-compile-time

Log-level

  • LOG_LEVEL_NONE -> No Logging
  • LOG_LEVEL_ERR -> Only Logging errors
  • LOG_LEVEL_WARN -> Logging errors and warnings
  • LOG_LEVEL_INFO -> Logging errors, warnings, infos and extras

Examples

#define LOG_LEVEL_ERROR     // defaults to Info, when undefined
#include "clog.h"

clog_info("This is an info!");
clog_warn("This is a warning!");
clog_error("This is an error!");
clog_extra("This is an extra message!");

Formatted Logging

clogf_info("Test: %d\n", 1234);
clogf_warn("Test: %f\n", 3.14159f);
clogf_error("Test: %d\n", 1234);
clogf_extra("Test: %s\n", "string");

Log-Info

clogf_info("Warnings: %d\n", clog_warn_count());

Extra pre-compile #defines

  • LOG_ONLY_COLORS -> disable Lables [INFO / WARN / ERR / EXTRA]
  • LOG_NO_TIMESTAMPS -> disables timestamps

🔴 all defines have to be set before including clog.h 🔴

Sample Output

image

About

C-logger, single header-only libary (stb)

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages