当前位置:网站首页>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
边栏推荐
- Solve the problem that pycharm Chinese input method does not follow
- ConstraintLayout跟RelativeLayout嵌套出现的莫名奇妙的问题
- 11. Provider service registration of Nacos service registration source code analysis
- Solution: jupyter notebook does not pop up the default browser
- (2) Base
- 使用onvif协议操作设备
- 公司测试部门来了个00后卷王之王,老油条感叹真干不过,但是...
- Imread change image display size
- 栈,单调栈,队列,单调队列
- Execute kubectl on Tencent cloud container service node
猜你喜欢

解决undefined reference to `__aeabi_uidivmod‘和undefined reference to `__aeabi_uidiv‘错误

10. Nacos source code construction

AIDL

封装一个koa分布式锁中间件来解决幂等或重复请求的问题

11. Provider service registration of Nacos service registration source code analysis

Summary of interview questions (2) IO model, set, NiO principle, cache penetration, breakdown avalanche

在职美团测试工程师的这八年,我是如何成长的,愿技术人看完都有收获

软件测试工程师的5年之痒,讲述两年突破瓶颈经验

8年测试工程师总结出来的《测试核心价值》与《0基础转行软件测试超全学习指南》

Software testing e-commerce projects that can be written into your resume, don't you come in and get it?
随机推荐
项目管理精华读书笔记(七)
Hal - General
(二)进制
Résumé des questions d'entrevue (2) Modèle io, ensemble, principe NiO, pénétration du cache, avalanche de rupture
Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
反正切熵(Arctangent entropy):2022.7月最新SCI论文
Game test related tests a hero's skills (spring moves are asked more questions)
Typescript learning summary
One hot code
Execute kubectl on Tencent cloud container service node
Internet Socket (非)阻塞write/read n个字节
After a month, I finally got Kingdee offer! Share tetrahedral Sutra + review materials
POI excel 单元格换行
Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
Hard goods | write all the codes as soon as you change the test steps? Why not try yaml to realize data-driven?
Kotlin's use of the no Arg compiler plug-in in gradle
Matlab memory variable management command
如何清理v$rman_backup_job_details视图 报错ORA-02030
C语言二维数组
2. Hal hardware abstraction layer