当前位置:网站首页>C language log base zlog basic use
C language log base zlog basic use
2022-07-03 11:17:00 【B! GGer.】
1、zlog The download 、 Compilation and installation
git clone https://github.com/HardySimpson/zlog.git
vim src/makefile
Set the installation path PREFIX
Set up tool chain CC
Compilation problems :
relocation R_X86_64_PC32 against symbol `zlog_conf_del'......recompile with –fPIC
resolvent :REAL_CFLAGS Before adding CFLAGS += -fPIC
make
make install
2、 User manual
http://hardysimpson.github.io/zlog/UsersGuide-CN.html
3、 Reference configuration
[global]
strict init = true
reload conf period = 0
buffer min = 1024
buffer max = 2MB
rotate lock file = self
default format = "%d(%F %T.%l) %-6V (%c:%F:%L) - %m%n"
file perms = 666
fsync period = 1K
[levels]
#TRACE = 10
#CRIT = 130, LOG_CRIT
[formats]
simple = "%m%n"
normal = "%d [%V] [%U:%L] %m%n"
[rules]
test.* >stdout; normal
test_log.* "./test.log", 1KB*4 ~ "./test-%d(%Y%m%d).#2s.log"; normal
4、 Reference resources demo
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "zlog.h"
int main(int argc, const char *argv[])
{
int rc;
zlog_category_t *c;
rc = zlog_init("./zlog.conf");// initialization
if (rc)
{
printf("init failed\n");
return -1;
}
c = zlog_get_category("test_log");// obtain test_log Classification and corresponding rules
if (!c)
{
printf("zlog_get_category failed\n");
zlog_fini();
return -2;
}
int i = 7;
zlog_info(c, "abcdecghilklmnopqrstuvwxyz:%d", i);// Write the log
zlog_fini();// clear
return 0;
}
5、 explain
[rules]
test_log.DEBUG "./test.log", 1KB*4 ~ "./test-%d(%Y%m%d).#2s.log"; normal
test_log: classification
DEBUG: The log level
"./test.log", 1KB*4 ~ "./test-%d(%Y%m%d).#2s.log"; normal: Specific rules
"./test.log": Log save path
1KB: Size of each log file
4: Save at most 4 Log files
"./test-%d(%Y%m%d).#2s.log": File transfer settings ( When the log file is full 1KB File transfer and save when )
normal: Set the log output format
边栏推荐
- glassfish org. h2.server. Shutdownhandler classnotfoundexception exception exception handling
- How to realize automatic testing in embedded software testing?
- [true question of the Blue Bridge Cup trials 44] scratch eliminate the skeleton Legion children programming explanation of the true question of the Blue Bridge Cup trials
- 线性表顺序表综合应用题P18
- 大厂技术专家:工程师如何提升沟通能力?
- Is pinduogai's sales safe in 2022?
- Software testing (test case) writing: vulgar, native and skillful
- 数据库增量备份 - DB INCR DB FULL
- 行业唯一!法大大电子合同上榜36氪硬核科技企业
- ConstraintLayout跟RelativeLayout嵌套出现的莫名奇妙的问题
猜你喜欢
What kind of living condition is a tester with a monthly salary of more than 10000?
Solve the problem that pycharm Chinese input method does not follow
面試題總結(2) IO模型,集合,NIO 原理,緩存穿透,擊穿雪崩
Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
The normal one inch is 25.4 cm, and the image field is 16 cm
做软件测试三年,薪资不到20K,今天,我提出了辞职…
[proteus simulation] 16 channel water lamp composed of 74hc154 four wire to 12 wire decoder
基于I2C协议的驱动开发
Stack, monotone stack, queue, monotone queue
8年测试工程师总结出来的《测试核心价值》与《0基础转行软件测试超全学习指南》
随机推荐
"Core values of testing" and "super complete learning guide for 0 basic software testing" summarized by test engineers for 8 years
Solution: jupyter notebook does not pop up the default browser
历经一个月,终于拿到金蝶Offer!分享一下四面面经+复习资料
[proteus simulation] 16 channel water lamp composed of 74hc154 four wire to 12 wire decoder
My understanding of testing (summarized by senior testers)
[true question of the Blue Bridge Cup trials 44] scratch eliminate the skeleton Legion children programming explanation of the true question of the Blue Bridge Cup trials
如何成为一名高级数字 IC 设计工程师(1-3)Verilog 编码语法篇:Verilog 行为级、寄存器传输级、门级(抽象级别)
如何成为一名高级数字 IC 设计工程师(1-5)Verilog 编码语法篇:操作数
触摸与屏幕自动旋转调试
T5 attempt
How to realize automatic testing in embedded software testing?
表空间创建管理及控制文件管理
00后抛弃互联网: 毕业不想进大厂,要去搞最潮Web3
2022 pinduogai 100000 sales tutorial
Summary of the history of Mathematics
one hot 独热码
VPP三层网络互联配置
Solutions of n-ary linear equations and their criteria
EPS电动转向系统分析
Google Earth Engine(GEE)——GHSL 全球人口网格数据集250米分辨率