Linux Shared library Zlog logs

Source: Internet
Author: User

Global ]strict init    false1024x768= 2MB    lock file=        /tmp/zlog. Lock  "%d.%us [%v][%f:%l]%m%n"[rules]asr_level. *        "/home/test/asr.log"; normal

NOTE: If you configure the Rotate lock file entry, in your own native test, be careful to delete the Zlog.lock file, or it may be locked, resulting in zlog initialization failure

Zlog parameter configuration details [formats]%d    -represents time, such as 2018-07-20 09:32:43%us   -Indicates subtlety, such as 991437%f    -represents a file, such as Test_init.c%v    --Indicates the log level, for example debug,info%l    --Indicates the line number%m    --Represents the user output information%n    --Represents the line break normal = "%d.%us [%v][%f:%l]%m%n" [Rules] category name. *          --Indicates that all levels of the log information class alias are printed. =debug     --Indicates the log category name at the specified level is printed. Debug     -Indicates a non-debug-level log is printed
#ifndef __asr_zlog_h_#define__asr_zlog_h_#include"zlog.h"/*Log Class*/externzlog_category_t *Zc;//Initialize ZlogintZloginit (Const Char*pcconfigpath,Const Char*pcmodelname);//Release Zlogvoidzlogdestory ();#defineFatal_log (fmt,...) \zlog_fatal (zc,fmt,__va_args__);#defineError_log (fmt,...) \Zlog_error (zc,fmt,__va_args__);#defineWarn_log (fmt,...) \Zlog_warn (zc,fmt,__va_args__);#defineNotice_log (fmt,...) \Zlog_notice (zc,fmt,__va_args__);#defineInfo_log (fmt,...) \Zlog_info (zc,fmt,__va_args__);#defineDebug_log (fmt,...) \Zlog_debug (zc,fmt,__va_args__);#endif
#include <stdarg.h>#include"asr_log.h"#include"comontype.h"zlog_category_t*Zc;/********************************************************zlog*********************************************** **********//******************************************************** Func name:initdate created:2018-7-20 Description: Initialization Input:Output:Return:error code Caution: *********************************************************/intZloginit (inConst Char*pcconfigpath,inConst Char*pcmodelname) {    intIRet =Default_error; if(NULL = = Pcconfigpath | | NULL = =pcmodelname) {IRet=Param_error; returnIRet; } IRet=Zlog_init (Pcconfigpath); if(IRet) {printf ("Init fail"); returnDefault_error; } ZC=zlog_get_category (pcmodelname); if(!ZC) {printf ("zlog_get_category fail\n");        Zlog_fini (); returnDefault_error; }    returnResult_ok;}/******************************************************** Func name:initdate created:2018-7-20 Description: Destroy Zlog Input:Output:Return:Caution: *********************************************************/voidzlogdestory () {Zlog_fini ();}

Linux Shared library Zlog logs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.