Code Monkey home page Code Monkey logo

klog's Introduction

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.

klog's People

Contributors

minkikim89 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.