Skip to content

klog is a simple logging library for c language

License

Notifications You must be signed in to change notification settings

minkikim89/klog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

klog

klog is a simple logger for c language.

Screenshot

  • Console log mode

screenshot_console

  • File log mode

screenshot_file

Level

TRACE, DEBUG, INFO(default), WARN, ERROR, FATAL

Feature

  • Thread-safe
  • Color print
  • Logs to console, file
  • File log lotation (by file size)

usage

Copy klog.c, klog.h files and compile with your project.

If you want to use console log, use NULL parameter.

klog_init(NULL);
klog_set_loglevel(KLOG_TRACE);
klog_trace("Hi!");
klog_debug("This is a simple log library.");
klog_info("It is very lightweight and easy to use.");
klog_warn("You can print logs to a console or a file.");
klog_error("Try out.");
klog_fatal(":-)");

If you want to use file log, pass a file path as a parameter

klog_init("./log");
klog_set_loglevel(KLOG_TRACE);
klog_info("This is info log.");
klog_warn("This is warn log.");

See the code sample_code.c for more details.

About

klog is a simple logging library for c language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages