[MERGED] osmo-bsc[master]: libcommon: eliminate debug.c

2018-02-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: libcommon: eliminate debug.c
..


libcommon: eliminate debug.c

Provide concise log categories for each main scope.

Move the complete log categories 1:1 to osmo_bsc_main.c.

In bsc_nat.c, omit obviously unused log categories.

In tests, omit almost all log categories, except for those explicitly tested as
the expected output.

Note: should any logging occur for a log category that is omitted by accident,
such will end up being logged as DLGLOBAL, so it will show up and we can fix
it, and it will not get lost silently.

Change-Id: Ib524e49ec211662e0dfde8161495a72aa8ad76cf
---
M include/osmocom/bsc/debug.h
M src/ipaccess/ipaccess-config.c
M src/ipaccess/ipaccess-proxy.c
M src/libcommon/Makefile.am
D src/libcommon/debug.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc_nat/bsc_nat.c
M src/utils/bs11_config.c
M tests/abis/abis_test.c
M tests/bsc-nat-trie/bsc_nat_trie_test.c
M tests/bsc-nat/bsc_nat_test.c
M tests/bsc/bsc_test.c
M tests/bssap/bssap_test.c
M tests/channel/channel_test.c
M tests/gsm0408/gsm0408_test.c
M tests/nanobts_omlattr/nanobts_omlattr_test.c
M tests/subscr/bsc_subscr_test.c
17 files changed, 373 insertions(+), 243 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/debug.h b/include/osmocom/bsc/debug.h
index 131ae8a..b9295a0 100644
--- a/include/osmocom/bsc/debug.h
+++ b/include/osmocom/bsc/debug.h
@@ -44,5 +44,3 @@
DSIGTRAN,
Debug_LastEntry,
 };
-
-extern const struct log_info log_info;
diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index 957a5bb..7e8cafd 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -838,6 +838,20 @@
 
 extern void bts_model_nanobts_init();
 
+static const struct log_info_cat log_categories[] = {
+   [DNM] = {
+   .name = "DNM",
+   .description = "A-bis Network Management / O (NM/OML)",
+   .color = "\033[1;36m",
+   .enabled = 1, .loglevel = LOGL_INFO,
+   },
+};
+
+static const struct log_info log_info = {
+   .cat = log_categories,
+   .num_cat = ARRAY_SIZE(log_categories),
+};
+
 int main(int argc, char **argv)
 {
struct gsm_bts *bts;
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index b45b543..40749ee 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -1200,6 +1200,20 @@
}
 }
 
+static const struct log_info_cat log_categories[] = {
+   [DMM] = {
+   .name = "DMM",
+   .description = "Layer3 Mobility Management (MM)",
+   .color = "\033[1;33m",
+   .enabled = 1, .loglevel = LOGL_NOTICE,
+   },
+};
+
+const struct log_info log_info = {
+   .cat = log_categories,
+   .num_cat = ARRAY_SIZE(log_categories),
+};
+
 int main(int argc, char **argv)
 {
int rc;
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 1a73e6c..1f7f5c4 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,7 +20,6 @@
$(NULL)
 
 libcommon_a_SOURCES = \
-   debug.c \
gsm_data.c \
gsm_data_shared.c \
socket.c \
diff --git a/src/libcommon/debug.c b/src/libcommon/debug.c
deleted file mode 100644
index b5a490b..000
--- a/src/libcommon/debug.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* OpenBSC Debugging/Logging support code */
-
-/* (C) 2008-2010 by Harald Welte 
- * (C) 2008 by Holger Hans Peter Freyther 
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* default categories */
-static const struct log_info_cat default_categories[] = {
-   [DRLL] = {
-   .name = "DRLL",
-   .description = "A-bis Radio Link Layer (RLL)",
-   .color = "\033[1;31m",
-   .enabled = 1, .loglevel = LOGL_NOTICE,
-   },
-   [DCC] = {
-   .name = "DCC",
-   .description = "Layer3 Call Control (CC)",
-   .color = 

osmo-bsc[master]: libcommon: eliminate debug.c

2018-02-14 Thread Harald Welte

Patch Set 3: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/6430
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib524e49ec211662e0dfde8161495a72aa8ad76cf
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-bsc[master]: libcommon: eliminate debug.c

2018-02-13 Thread Neels Hofmeyr

Review at  https://gerrit.osmocom.org/6430

libcommon: eliminate debug.c

Provide concise log categories for each main scope.

Move the complete log categories 1:1 to osmo_bsc_main.c.

In bsc_nat.c, omit obviously unused log categories.

In tests, omit almost all log categories, except for those explicitly tested as
the expected output.

Note: should any logging occur for a log category that is omitted by accident,
such will end up being logged as DLGLOBAL, so it will show up and we can fix
it, and it will not get lost silently.

Change-Id: Ib524e49ec211662e0dfde8161495a72aa8ad76cf
---
M include/osmocom/bsc/debug.h
M src/ipaccess/ipaccess-config.c
M src/ipaccess/ipaccess-proxy.c
M src/libcommon/Makefile.am
D src/libcommon/debug.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc_nat/bsc_nat.c
M src/utils/bs11_config.c
M tests/abis/abis_test.c
M tests/bsc-nat-trie/bsc_nat_trie_test.c
M tests/bsc-nat/bsc_nat_test.c
M tests/bsc/bsc_test.c
M tests/bssap/bssap_test.c
M tests/channel/channel_test.c
M tests/gsm0408/gsm0408_test.c
M tests/nanobts_omlattr/nanobts_omlattr_test.c
M tests/subscr/bsc_subscr_test.c
17 files changed, 373 insertions(+), 243 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/30/6430/1

diff --git a/include/osmocom/bsc/debug.h b/include/osmocom/bsc/debug.h
index 131ae8a..b9295a0 100644
--- a/include/osmocom/bsc/debug.h
+++ b/include/osmocom/bsc/debug.h
@@ -44,5 +44,3 @@
DSIGTRAN,
Debug_LastEntry,
 };
-
-extern const struct log_info log_info;
diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index 957a5bb..7e8cafd 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -838,6 +838,20 @@
 
 extern void bts_model_nanobts_init();
 
+static const struct log_info_cat log_categories[] = {
+   [DNM] = {
+   .name = "DNM",
+   .description = "A-bis Network Management / O (NM/OML)",
+   .color = "\033[1;36m",
+   .enabled = 1, .loglevel = LOGL_INFO,
+   },
+};
+
+static const struct log_info log_info = {
+   .cat = log_categories,
+   .num_cat = ARRAY_SIZE(log_categories),
+};
+
 int main(int argc, char **argv)
 {
struct gsm_bts *bts;
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index b45b543..40749ee 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -1200,6 +1200,20 @@
}
 }
 
+static const struct log_info_cat log_categories[] = {
+   [DMM] = {
+   .name = "DMM",
+   .description = "Layer3 Mobility Management (MM)",
+   .color = "\033[1;33m",
+   .enabled = 1, .loglevel = LOGL_NOTICE,
+   },
+};
+
+const struct log_info log_info = {
+   .cat = log_categories,
+   .num_cat = ARRAY_SIZE(log_categories),
+};
+
 int main(int argc, char **argv)
 {
int rc;
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 1a73e6c..1f7f5c4 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,7 +20,6 @@
$(NULL)
 
 libcommon_a_SOURCES = \
-   debug.c \
gsm_data.c \
gsm_data_shared.c \
socket.c \
diff --git a/src/libcommon/debug.c b/src/libcommon/debug.c
deleted file mode 100644
index b5a490b..000
--- a/src/libcommon/debug.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* OpenBSC Debugging/Logging support code */
-
-/* (C) 2008-2010 by Harald Welte 
- * (C) 2008 by Holger Hans Peter Freyther 
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* default categories */
-static const struct log_info_cat default_categories[] = {
-   [DRLL] = {
-   .name = "DRLL",
-   .description = "A-bis Radio Link Layer (RLL)",
-   .color = "\033[1;31m",
-   .enabled = 1, .loglevel = LOGL_NOTICE,
-   },
-   [DCC] = {
-   .name = "DCC",
-   .description = "Layer3 Call Control (CC)",
-   .color = "\033[1;32m",
-   .enabled = 1, .loglevel = LOGL_NOTICE,
-   },
-   [DMM] = {
-   .name = "DMM",
-