Skip to content

stevepan643/c-tiny-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

C tiny logger

A tiny, head-only logging library for C. Minimal, portable, and easy to drop into any project.

✨ Features

  • Log levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
  • Colorized terminal output(ANSI)
  • Timestamped log messages
  • Output to stdout/stderr or a file
  • Compile-time log level filtering
  • Zero external dependencies

📦 Getting started

  1. Add to your project Just copy logger.h into your source tree.
  2. In one *.c file (e.g., main.c), define the implementation
#include LOGGER_IMPLEMENTATION
#include "logger.h"
  1. Include only in other file

⚙️ API

void log_set_level(LogLevel level);
void log_set_file(FILE *f);
void log_log(LogLevel level, const char* fmt, ...);

Convenience macros:

LOG_TRACE(...);
LOG_DEBUG(...);
LOG_INFO(...);
LOG_WARN(...);
LOG_ERROR(...);
LOG_FATAL(...);

📜 License

MIT License – free for personal and commercial use. (see more details)

About

A minimal, head-only logging library for C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages