diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-22 22:32:51 +0100 |
---|---|---|
committer | Harald Welte <laforge@netfilter.org> | 2009-12-22 22:32:51 +0100 |
commit | b61e3b21580afc6381a6c72618d51697c7ce9771 (patch) | |
tree | 2a88eb434a28d4064f7017fd1202f10e88f341f7 /openbsc/src/bsc_hack.c | |
parent | 0f9141384bc338cdf8db805fbfe502aed622f816 (diff) |
Import the new logging architecture
This is the new logging architecture, including
* support for multiuple logging targets like stderr and vty
* log levels in addition to categories/subsystems
* filtering based on imsi, i.e. only see events for one subscriber
* dynamically change log level for each category for each vty
Diffstat (limited to 'openbsc/src/bsc_hack.c')
-rw-r--r-- | openbsc/src/bsc_hack.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/openbsc/src/bsc_hack.c b/openbsc/src/bsc_hack.c index a9a5d372f..0d20d43d3 100644 --- a/openbsc/src/bsc_hack.c +++ b/openbsc/src/bsc_hack.c @@ -38,6 +38,7 @@ #include <openbsc/signal.h> /* MCC and MNC for the Location Area Identifier */ +static struct debug_target *stderr_target; struct gsm_network *bsc_gsmnet = 0; static const char *database_name = "hlr.sqlite3"; static const char *config_file = "openbsc.cfg"; @@ -105,10 +106,10 @@ static void handle_options(int argc, char** argv) print_help(); exit(0); case 's': - debug_use_color(0); + debug_set_use_color(stderr_target, 0); break; case 'd': - debug_parse_category_mask(optarg); + debug_parse_category_mask(stderr_target, optarg); break; case 'l': database_name = strdup(optarg); @@ -120,7 +121,7 @@ static void handle_options(int argc, char** argv) create_pcap_file(optarg); break; case 'T': - debug_timestamp(1); + debug_set_print_timestamp(stderr_target, 1); break; case 'P': ipacc_rtp_direct = 0; @@ -158,11 +159,17 @@ int main(int argc, char **argv) { int rc; + debug_init(); tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc"); talloc_ctx_init(); on_dso_load_token(); on_dso_load_rrlp(); on_dso_load_ho_dec(); + stderr_target = debug_target_create_stderr(); + debug_add_target(stderr_target); + + /* enable filters */ + debug_set_all_filter(stderr_target, 1); /* parse options */ handle_options(argc, argv); @@ -193,6 +200,7 @@ int main(int argc, char **argv) while (1) { bsc_upqueue(bsc_gsmnet); + debug_reset_context(); bsc_select_main(0); } } |