Change in mncc-python[master]: *.py: cosmetic: tweak the global logging format

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sun Sep 30 10:22:11 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/11159


Change subject: *.py: cosmetic: tweak the global logging format
......................................................................

*.py: cosmetic: tweak the global logging format

Printing log level, file name, and line number together with a
log message is the common practice in Osmocom projects that
facilitates debugging and development.

Change-Id: I80cd7cdfa41ae7e70a1890d88c8b2f7357a500af
---
M contrib/manual_test_server.py
M mncc_test.py
M smpp_test.py
3 files changed, 9 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/mncc-python refs/changes/59/11159/1

diff --git a/contrib/manual_test_server.py b/contrib/manual_test_server.py
index 5625670..d92eb84 100644
--- a/contrib/manual_test_server.py
+++ b/contrib/manual_test_server.py
@@ -3,6 +3,8 @@
 import ctypes
 import socket
 
+import logging as log
+
 GSM340_PLAN_ISDN = 1
 GSM340_TYPE_NATIONAL = 2
 
@@ -80,6 +82,9 @@
     conn.send_msg(MnccMessageBuilder.build_dtmf_stop(callref, '2'))
 
 
+log.basicConfig(level = log.DEBUG,
+    format = "%(levelname)s %(filename)s:%(lineno)d %(message)s")
+
 server = mncc_sock.MnccSocketServer()
 conn = server.accept()
 
diff --git a/mncc_test.py b/mncc_test.py
index df66efb..9222605 100755
--- a/mncc_test.py
+++ b/mncc_test.py
@@ -48,7 +48,8 @@
     pykka.ActorRegistry.stop_all()
     sys.exit(0)
 
-logging.basicConfig(level=logging.DEBUG)
+logging.basicConfig(level = logging.DEBUG,
+    format = "%(levelname)s %(filename)s:%(lineno)d %(message)s")
 
 signal.signal(signal.SIGINT, sigint_handler)
 
diff --git a/smpp_test.py b/smpp_test.py
index 181f60d..ad7d4dc 100755
--- a/smpp_test.py
+++ b/smpp_test.py
@@ -11,7 +11,8 @@
 # to generate some SMS load on OsmoNITB via its SMPP interface
 
 # if you want to know what's happening
-logging.basicConfig(level='DEBUG')
+logging.basicConfig(level = logging.DEBUG,
+    format = "%(levelname)s %(filename)s:%(lineno)d %(message)s")
 
 def send_message(dest, string):
     parts, encoding_flag, msg_type_flag = smpplib.gsm.make_parts(string)

-- 
To view, visit https://gerrit.osmocom.org/11159
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I80cd7cdfa41ae7e70a1890d88c8b2f7357a500af
Gerrit-Change-Number: 11159
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180930/c47444a5/attachment.htm>


More information about the gerrit-log mailing list