diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-06 21:49:41 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-04-06 21:51:26 +0200 |
commit | 9960d59fffa176ab022c9641c7358030d7f8065c (patch) | |
tree | 18573b4edf3eb496307d4b33d99ca031c98c3981 /openbsc/include/openbsc/debug.h | |
parent | 161bd6d253abeef6b181dbe9fdd245bd7c9884af (diff) | |
parent | 3c71232b112a40bf09bd9687f1bc6aed12e863a3 (diff) |
Merge remote branch 'origin/master' into on-waves/bsc-master
* Move to the new log code and update binaries
* Catch up with lchan changes from master
Conflicts:
openbsc/include/openbsc/Makefile.am
openbsc/include/openbsc/gsm_data.h
openbsc/src/Makefile.am
openbsc/src/bsc_rll.c
openbsc/src/chan_alloc.c
openbsc/src/debug.c
openbsc/src/gsm_04_08.c
openbsc/src/gsm_04_11.c
openbsc/src/gsm_subscriber_base.c
openbsc/src/handover_logic.c
openbsc/src/silent_call.c
openbsc/src/transaction.c
openbsc/src/vty_interface.c
openbsc/src/vty_interface_cmds.c
Diffstat (limited to 'openbsc/include/openbsc/debug.h')
-rw-r--r-- | openbsc/include/openbsc/debug.h | 89 |
1 files changed, 5 insertions, 84 deletions
diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index 31e404d6c..c96d58922 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -5,6 +5,7 @@ #include <osmocore/linuxlist.h> #define DEBUG +#include <osmocore/logging.h> /* Debug Areas of the code */ enum { @@ -32,31 +33,6 @@ enum { Debug_LastEntry, }; -#ifdef DEBUG -#define DEBUGP(ss, fmt, args...) debugp(ss, __FILE__, __LINE__, 0, fmt, ## args) -#define DEBUGPC(ss, fmt, args...) debugp(ss, __FILE__, __LINE__, 1, fmt, ## args) -#else -#define DEBUGP(xss, fmt, args...) -#define DEBUGPC(ss, fmt, args...) -#endif - - -#define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; - -char *hexdump(const unsigned char *buf, int len); -void debugp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6))); - -/* new logging interface */ -#define LOGP(ss, level, fmt, args...) debugp2(ss, level, __FILE__, __LINE__, 0, fmt, ##args) -#define LOGPC(ss, level, fmt, args...) debugp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args) - -/* different levels */ -#define LOGL_DEBUG 1 /* debugging information */ -#define LOGL_INFO 3 -#define LOGL_NOTICE 5 /* abnormal/unexpected condition */ -#define LOGL_ERROR 7 /* error condition, requires user action */ -#define LOGL_FATAL 8 /* fatal, program aborted */ - /* context */ #define BSC_CTX_LCHAN 0 #define BSC_CTX_SUBSCR 1 @@ -66,67 +42,12 @@ void debugp(unsigned int subsys, char *file, int line, int cont, const char *for /* target */ enum { - DEBUG_FILTER_IMSI = 1 << 0, - DEBUG_FILTER_ALL = 1 << 1, -}; - -struct debug_category { - int enabled; - int loglevel; + //DEBUG_FILTER_ALL = 1 << 0, + LOG_FILTER_IMSI = 1 << 1, }; -struct debug_target { - int filter_map; - char *imsi_filter; - - - struct debug_category categories[Debug_LastEntry]; - int use_color; - int print_timestamp; - int loglevel; - - union { - struct { - FILE *out; - } tgt_stdout; - - struct { - int priority; - } tgt_syslog; - - struct { - void *vty; - } tgt_vty; - }; - - void (*output) (struct debug_target *target, const char *string); - - struct llist_head entry; -}; - -/* use the above macros */ -void debugp2(unsigned int subsys, unsigned int level, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 6, 7))); -void debug_init(void); - -/* context management */ -void debug_reset_context(void); -void debug_set_context(int ctx, void *value); - -/* filter on the targets */ -void debug_set_imsi_filter(struct debug_target *target, const char *imsi); -void debug_set_all_filter(struct debug_target *target, int); -void debug_set_use_color(struct debug_target *target, int); -void debug_set_print_timestamp(struct debug_target *target, int); -void debug_set_log_level(struct debug_target *target, int log_level); -void debug_parse_category_mask(struct debug_target *target, const char* mask); -int debug_parse_level(const char *lvl); -int debug_parse_category(const char *category); -void debug_set_category_filter(struct debug_target *target, int category, int enable, int level); +void log_set_imsi_filter(struct log_target *target, const char *imsi); +extern const struct log_info log_info; -/* management of the targets */ -struct debug_target *debug_target_create(void); -struct debug_target *debug_target_create_stderr(void); -void debug_add_target(struct debug_target *target); -void debug_del_target(struct debug_target *target); #endif /* _DEBUG_H */ |