- fix Building without Nagra not possible at Nagra_Merlin https://trac.streamboard...
[oscam.git] / oscam-log.h
blob8e0646df3d4c4d2e8cfd691102c6341b8e4bf7c9
1 #ifndef OSCAM_LOG_H_
2 #define OSCAM_LOG_H_
4 #ifndef MODULE_LOG_PREFIX
5 #define MODULE_LOG_PREFIX NULL
6 #endif
8 int32_t cs_init_log(void);
9 void cs_reopen_log(void);
10 int32_t cs_open_logfiles(void);
11 void cs_disable_log(int8_t disabled);
12 void cs_reinit_loghist(uint32_t size);
14 void cs_log_txt(const char *log_prefix, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
15 void cs_log_hex(const char *log_prefix, const uint8_t *buf, int32_t n, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
17 #define cs_log(fmt, params...) cs_log_txt(MODULE_LOG_PREFIX, fmt, ##params)
18 #define cs_log_dump(buf, n, fmt, params...) cs_log_hex(MODULE_LOG_PREFIX, buf, n, fmt, ##params)
20 #define cs_log_dbg(mask, fmt, params...) do { if (config_enabled(WITH_DEBUG) && ((mask) & cs_dblevel)) cs_log_txt(MODULE_LOG_PREFIX, fmt, ##params); } while(0)
21 #define cs_log_dump_dbg(mask, buf, n, fmt, params...) do { if (config_enabled(WITH_DEBUG) && ((mask) & cs_dblevel)) cs_log_hex(MODULE_LOG_PREFIX, buf , n, fmt, ##params); } while(0)
23 int32_t cs_init_statistics(void);
24 void cs_statistics(struct s_client *client);
26 void log_free(void);
28 // Compatability with older function names. If your code uses these
29 // it must migrate to the new names using find + replace
30 // *** DO NOT USE OLD NAMES NEW CODE! ***
31 #define cs_debug_mask cs_log_dbg
32 #define rdr_debug_mask rdr_log_dbg
33 #define rdr_debug_mask_sensitive rdr_log_dbg_sensitive
34 #define cs_ddump_mask cs_log_dump_dbg
35 #define rdr_ddump_mask rdr_log_dump_dbg
37 #if defined(WEBIF) || defined(MODULE_MONITOR)
39 extern LLIST *log_history;
41 struct s_log_history
43 char *txt;
44 uint64_t counter;
47 #endif
49 #endif