blob: 218ece1c594a3b6b05970f98e2c99736567c7986 [file] [log] [blame]
xf.libfc6e712025-02-07 01:54:34 -08001#ifndef UPI_LOG_H
2#define UPI_LOG_H
3
4
5extern FILE* s_FP_LOG;
6extern long cur_log_size;
7
8//#define FOTA_UPI_AB_LOG_ROOT "/cache/zte_fota_ab/"
9
10//#define FOTA_UPI_AB_LOG_PATH "/cache/zte_fota_ab/upi_ab.log"
11
12#define FOTA_LOG_PATH "fota_ab_log_path"
13
14
15#ifdef _IS_MIN
16
17
18#define upi_print(...) do { \
19 printf(__VA_ARGS__); \
20 } while(0)
21
22
23#else
24
25#define upi_print(...) do { \
26 printf(__VA_ARGS__); \
27 char buffer_log[512] = {0}; \
28 snprintf(buffer_log, 510, __VA_ARGS__); \
29 upi_fwrite(buffer_log); \
30 } while(0)
31
32
33#endif
34
35
36
37#define upi_log(fmt, args...) \
38 do {upi_print("[%s][fota_upi] [%s-%d]: " fmt"\n", upi_get_time_us(),__FUNCTION__, __LINE__, ## args);} while (0)
39#define upi_err(fmt, args...) \
40 do {upi_print("[%s][fota_upi] [%s-%d]: " fmt"\n", upi_get_time_us(),__FUNCTION__, __LINE__, ## args);} while (0)
41#if 0
42#define lib_log(fmt, args...) \
43 do {upi_print(FOTA_UPI_AB_LOG_PATH, "" fmt"\n", ## args);} while (0)
44#endif
45
46
47#define LOG_FUNC_BEGIN upi_log("%s func begin!", __func__);
48#define LOG_FUNC_END upi_log("%s func end!", __func__);
49
50
51void upi_fwrite(char* info);
52void upi_close_logfile(void);
53char * upi_get_time_us(void);
54
55unsigned int timestamp_now(void);
56
57#endif /*UPI_LOG_H*/