lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====* |
| 2 | LINUX ZTE LOG MODULE |
| 3 | |
| 4 | GENERAL DESCRIPTION |
| 5 | print the log to the log file |
| 6 | *====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/ |
| 7 | |
| 8 | #ifndef _ZTE_LOG_ |
| 9 | #define _ZTE_LOG_ |
| 10 | /*=========================================================================== |
| 11 | INCLUDES |
| 12 | ===========================================================================*/ |
| 13 | #include<stdarg.h> |
| 14 | #include<stdio.h> |
| 15 | #include<stdlib.h> |
| 16 | /*=========================================================================== |
| 17 | DATA |
| 18 | ===========================================================================*/ |
| 19 | #define NV_LOG_BUF_LEN 5 |
| 20 | #define MAX_PARA_BUF 512 |
| 21 | #define MAX_LOG_BUF MAX_PARA_BUF+64 |
| 22 | //#define LOG_DIR_PATH "/tmp/zte_log/" |
| 23 | //#define LOG_DIR_PATH "/usr/" |
| 24 | #define LOG_DIR_PATH "/var/log" |
| 25 | #define OP_APPEND ">>" |
| 26 | |
| 27 | /*------------suggested log name for every process-------------------*/ |
| 28 | #define LOG_GOAHEAD_LOG "goahead.log" |
| 29 | #define LOG_WIFI_CONTROL_LOG "wifi_control.log" |
| 30 | #define LOG_PPP_DIAL_LOG "ppp_dial.log" |
| 31 | #define LOG_WAKEUP_MC_LOG "wakeup_maincontrol.log" |
| 32 | #define LOG_ZTE_LAN_LOG "zte_lan.log" |
| 33 | #define LOG_ZTE_LIBSOCKET_LOG "zte_libsocket.log" |
| 34 | #define LOG_ZTE_MODC_LOG "zte_modc.log" |
| 35 | #define LOG_ZTE_WMS_LOG "zte_wms.log" |
| 36 | #define LOG_ZTE_PBM_LOG "zte_pbm.log" |
| 37 | #define LOG_ZTE_AT_LOG "zte_at.log" |
| 38 | #define LOG_ZTE_CFG_LOG "zte_cfg.log" |
| 39 | #define LOG_ZTE_NV_LOG "zte_nv.log" |
| 40 | #define LOG_ZTE_MC_LOG "zte_mc.log" |
| 41 | #define LOG_ZTE_MDM_LOG "zte_mdm.log" |
| 42 | #define LOG_ZTE_WAN_LOG "zte_wan.log" |
| 43 | #define LOG_ZTE_QMI_LOG "zte_qmi.log" |
| 44 | #define LOG_ZTE_SHARE_LOG "zte_share.log" |
| 45 | #define LOG_ZTE_DAEMON_LOG "zte_daemon.log" |
| 46 | #define LOG_ZTE_USSD_LOG "zte_ussd.log" |
| 47 | #define LOG_ZTE_NTP_LOG "zte_ntp.log" |
| 48 | #define LOG_ZTE_MF80_LOG "zte_mf80.log" |
| 49 | #define LOG_ZTE_PRINTER_LOG "zte_printer.log" |
| 50 | |
| 51 | /*-------------------------------------------------------------------------------------------- |
| 52 | --------- ZTE_MSG just like qualcomm's MSG macro ---------- |
| 53 | --------------------------------------------------------------------------------------------*/ |
| 54 | #define ZTE_MSG(fmt,a,b,c) zte_msg_print(__FILE__,__LINE__,fmt,a,b,c) |
| 55 | /*-------------------------------------------------------------------------------------------- |
| 56 | --------- @LOG_APPEND: this MARCO append the log to file tail ---------- |
| 57 | --------- @para: filename fmt ---------- |
| 58 | --------- @filename: the file log will be stored in ---------- |
| 59 | --------- @fmt :main log string ---------- |
| 60 | --------- @example: LOG_APPEND("logfile","hello MSG,%d,%d,%d",1,2,3) ---------- |
| 61 | --------- or LOG_APPEND("logfile","hello MSG") ---------- |
| 62 | ---------------------------------------------------------------------------------------------*/ |
| 63 | |
| 64 | #define LOG_APPEND(filename,...) zte_log_append(__FILE__,__LINE__,filename,__VA_ARGS__) |
| 65 | |
| 66 | #define SYS_CALL(...) zte_system_call(__VA_ARGS__) |
| 67 | #define WCLOG(...) LOG_APPEND(LOG_WIFI_CONTROL_LOG,__VA_ARGS__) /*for wifi_control*/ |
| 68 | #define PDLOG(...) LOG_APPEND(LOG_PPP_DIAL_LOG,__VA_ARGS__) /*for ppp_dial----*/ |
| 69 | #define WEBLOG(...) LOG_APPEND(LOG_GOAHEAD_LOG,__VA_ARGS__) /*for goahead-----*/ |
| 70 | #define WMLOG(...) LOG_APPEND(LOG_WAKEUP_MC_LOG,__VA_ARGS__) /*for wakeup main control*/ |
| 71 | #define LANLOG(...) LOG_APPEND(LOG_ZTE_LAN_LOG,__VA_ARGS__) /*for lan control*/ |
| 72 | #define LIBSOCKETLOG(...) LOG_APPEND(LOG_ZTE_LIBSOCKET_LOG,__VA_ARGS__) /*for libsocket*/ |
| 73 | #define MODCLOG(...) LOG_APPEND(LOG_ZTE_MODC_LOG,__VA_ARGS__) /*for mode control*/ |
| 74 | #define WMSLOG(...) LOG_APPEND(LOG_ZTE_WMS_LOG,__VA_ARGS__) /*for wms*/ |
| 75 | #define PBMLOG(...) LOG_APPEND(LOG_ZTE_PBM_LOG,__VA_ARGS__) /*for pbm*/ |
| 76 | #define ATLOG(...) LOG_APPEND(LOG_ZTE_AT_LOG,__VA_ARGS__) /*for at server*/ |
| 77 | #define CFGLOG(...) LOG_APPEND(LOG_ZTE_CFG_LOG,__VA_ARGS__) /*for cfg*/ |
| 78 | #define ZTENVLOG(...) LOG_APPEND(LOG_ZTE_NV_LOG,__VA_ARGS__) /*for zte nv*/ |
| 79 | #define MCLOG(...) LOG_APPEND(LOG_ZTE_MC_LOG,__VA_ARGS__) /*for main control*/ |
| 80 | #define MDMLOG(...) LOG_APPEND(LOG_ZTE_MDM_LOG,__VA_ARGS__) /*for mdm*/ |
| 81 | #define WANLOG(...) LOG_APPEND(LOG_ZTE_WAN_LOG,__VA_ARGS__) /*for wan*/ |
| 82 | #define QMILOG(...) LOG_APPEND(LOG_ZTE_QMI_LOG,__VA_ARGS__) /*for qmi*/ |
| 83 | #define SHARELOG(...) LOG_APPEND(LOG_ZTE_SHARE_LOG,__VA_ARGS__) /*for qmi*/ |
| 84 | #define DAEMONLOG(...) LOG_APPEND(LOG_ZTE_DAEMON_LOG,__VA_ARGS__) /*for daemon*/ |
| 85 | #define USSDLOG(...) LOG_APPEND(LOG_ZTE_USSD_LOG,__VA_ARGS__) /*for ussd*/ |
| 86 | #define NTPLOG(...) LOG_APPEND(LOG_ZTE_NTP_LOG,__VA_ARGS__) /*for ntp*/ |
| 87 | #define MF80LOG(...) LOG_APPEND(LOG_ZTE_MF80_LOG,__VA_ARGS__) /*for mf80 adaptor*/ |
| 88 | #define PRINTERLOG(...) LOG_APPEND(LOG_ZTE_PRINTER_LOG,__VA_ARGS__) /*for usb printer*/ |
| 89 | |
| 90 | void zte_log_append(const char *source_file,const unsigned int line, |
| 91 | const char *log_file,const char *fmt,...); |
| 92 | void zte_msg_print(const char *filename,const unsigned int line,const char *fmt,...); |
| 93 | void zte_system_call(const char *fmt,...); |
| 94 | |
| 95 | |
| 96 | #define ccapp_log(fmt,...) zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s "fmt"\n", __FUNCTION__, ##__VA_ARGS__) |
| 97 | |
| 98 | |
| 99 | #endif/*_ZTE_LOG_*/ |