joaonsantos / lclog

Lightweight C logger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lclog

This implements a very rudimentary C logger library for educational purposes.

lclog stands for (l)ightweight (C) (log)ger.

How to use

On your C program include the library header file:

#include <lclog.h>

int main() {
  // create a logger with your desired prefix
  lclog *logger = lclog_new("[INFO]");

  // ... do more stuff

  // use the logger
  lclog_log(logger, "application startup complete");

  // ... do more stuff

  // free the memory
  lclog_free(logger);
}

Installing

Install the library and headers to standard linux locations:

$ make && make install

Testing

To run tests:

$ make test

No output means all good!

About

Lightweight C logger


Languages

Language:C 64.8%Language:Makefile 35.2%