Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akagi201/lwlog
A lightweight header only logging library for C
https://github.com/akagi201/lwlog
c header-only lightweight log logging
Last synced: 4 days ago
JSON representation
A lightweight header only logging library for C
- Host: GitHub
- URL: https://github.com/akagi201/lwlog
- Owner: Akagi201
- License: mit
- Created: 2014-09-01T10:42:53.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-01-31T08:52:38.000Z (almost 3 years ago)
- Last Synced: 2023-08-05T08:53:47.704Z (over 1 year ago)
- Topics: c, header-only, lightweight, log, logging
- Language: C
- Homepage:
- Size: 200 KB
- Stars: 50
- Watchers: 2
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
lwlog
=====[![Build Status](https://travis-ci.org/Akagi201/lwlog.svg?branch=master)](https://travis-ci.org/Akagi201/lwlog)
A header only, colorful, leveled, macro implemented logging lib for C.
```C
lwlog_emerg("This a emerge log.");
lwlog_alert("This a alert log.");
lwlog_crit("This a crit log.");
lwlog_err("This a err log.");
lwlog_warning("This a warning log.");
lwlog_notice("This a notice log.");
lwlog_info("This a info log.");
lwlog_debug("This a debug log.");
```![screenshot](https://raw.github.com/Akagi201/lwlog/master/assets/lwlog.png)
## Features
* Only one header is needed.
* Colorful output to console.
* `errno` support.
* Simple APIs similar to printf().
* Support different logging levels.
* Zero performance overhead when logging is disabled.
* Customizable module name. [TODO]
* Transparent logging to file/console/network/syslog. [Maybe]## Install
`clib install Akagi201/lwlog`
## Macro controls
* log level control
* color control```C
#define LOG_COLOR (1) // 0: off, 1: on, default: 1
#define LOG_LEVEL (7) // -1: off, 0~7: different log levels, default: 7#include "lwlog.h"
```## Build & Test
```C
$ gcc test.c
$ ./a.out
```