aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-06-12 15:15:30 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2011-06-12 15:15:30 +0200
commite19c70a9ed605d13abb25bc4c875d4741e19530e (patch)
treea810c9292c58ca1381260391739f71ec72ecc79b /tests
parent0b099b27df4325f48749e2cec10dc6f52a21c513 (diff)
src: add support for logging infrastructure in libosmo-abis
This patch uses the new libosmocore logging infrastructure that allows to invoke log_init(&my_log_info) multiple times so we can register categories from libraries and applications.
Diffstat (limited to 'tests')
-rw-r--r--tests/e1inp_ipa_bsc_test.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/e1inp_ipa_bsc_test.c b/tests/e1inp_ipa_bsc_test.c
index b9b3711..6c1cacc 100644
--- a/tests/e1inp_ipa_bsc_test.c
+++ b/tests/e1inp_ipa_bsc_test.c
@@ -2,6 +2,8 @@
#include <talloc.h>
#include <osmocom/abis/abis.h>
#include <osmocom/abis/e1_input.h>
+#include <osmocom/core/application.h>
+#include <osmocom/core/logging.h>
static void *tall_test;
@@ -23,6 +25,23 @@ static int error(struct msgb *msg, int error)
return 0;
}
+#define DBSCTEST OSMO_LOG_SS_APPS
+
+struct log_info_cat bsc_test_cat[] = {
+ [DBSCTEST] = {
+ .name = "DBSCTEST",
+ .description = "BSC-mode test",
+ .color = "\033[1;35m",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
+};
+
+const struct log_info bsc_test_log_info = {
+ .filter_fn = NULL,
+ .cat = bsc_test_cat,
+ .num_cat = ARRAY_SIZE(bsc_test_cat),
+};
+
int main(void)
{
struct e1inp_line *line;
@@ -30,6 +49,8 @@ int main(void)
tall_test = talloc_named_const(NULL, 1, "e1inp_test");
libosmo_abis_init(tall_test);
+ osmo_init_logging(&bsc_test_log_info);
+
struct e1inp_line_ops ops = {
.sign_link_up = sign_link_up,
.sign_link = sign_link,
@@ -40,7 +61,7 @@ int main(void)
line = e1inp_line_create(LINENR, "ipa", &ops);
if (line == NULL) {
- fprintf(stderr, "problem creating E1 line\n");
+ LOGP(DBSCTEST, LOGL_ERROR, "problem creating E1 line\n");
exit(EXIT_FAILURE);
}
@@ -56,10 +77,12 @@ int main(void)
*/
if (e1inp_line_update(line, E1INP_LINE_R_BSC) < 0) {
- fprintf(stderr, "problem enabling E1 line\n");
+ LOGP(DBSCTEST, LOGL_ERROR, "problem creating E1 line\n");
exit(EXIT_FAILURE);
}
+ LOGP(DBSCTEST, LOGL_NOTICE, "entering main loop\n");
+
while (1) {
osmo_select_main(0);
}