UNIX 环境下轻量级的 C 语言日志组件,提供了常见的日志输出接口,并日志按一定格式输出到日志文件中。
支持日志归档,支持多线程并发写日志,多进程并发写日志,支持非阻塞日志。
代码仅一个 C,一个头文件,方便集成使用。
日志输出例子
[2018-04-03 21:52:13,485][INFO][ example.c:7 ] This is a log message.
特性
日志压缩归档。
日志级别输出。
日志格式定制。
非阻塞日志。
多线程并发写。
多进程并发写。
例子
#include <stdio.h>
#include "tlog.h"
int main(int argc, char *argv[])
{
tlog_init("./", "example.log", 1024 * 1024, 8, 1, 0, 0);
tlog(TLOG_INFO, "This is a log message.\n");
tlog_exit();
return 0;
}
项目地址: https://github.com/pymumu/tinylog
欢迎使用,提意见。
支持日志归档,支持多线程并发写日志,多进程并发写日志,支持非阻塞日志。
代码仅一个 C,一个头文件,方便集成使用。
日志输出例子
[2018-04-03 21:52:13,485][INFO][ example.c:7 ] This is a log message.
特性
日志压缩归档。
日志级别输出。
日志格式定制。
非阻塞日志。
多线程并发写。
多进程并发写。
例子
#include <stdio.h>
#include "tlog.h"
int main(int argc, char *argv[])
{
tlog_init("./", "example.log", 1024 * 1024, 8, 1, 0, 0);
tlog(TLOG_INFO, "This is a log message.\n");
tlog_exit();
return 0;
}
项目地址: https://github.com/pymumu/tinylog
欢迎使用,提意见。