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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18657 )
Change subject: process: Fix wrong use of log.ctx(self)
......................................................................
process: Fix wrong use of log.ctx(self)
That's not needed and will produce some parent loop detection in
log.find_on_stack() if logging is called under that stack frame.
Change-Id: I4ab7e8977fa9bad5c8956b7c1df1513b27bb5aa2
---
M src/osmo_gsm_tester/core/log.py
M src/osmo_gsm_tester/core/process.py
2 files changed, 6 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/57/18657/1
diff --git a/src/osmo_gsm_tester/core/log.py b/src/osmo_gsm_tester/core/log.py
index d60bf0b..8ae55d9 100644
--- a/src/osmo_gsm_tester/core/log.py
+++ b/src/osmo_gsm_tester/core/log.py
@@ -318,8 +318,12 @@
f = sys._getframe(2)
if origin_or_str is None:
f.f_locals.pop(LOG_CTX_VAR, None)
- else:
- f.f_locals[LOG_CTX_VAR] = origin_or_str
+ return
+ if isinstance(origin_or_str, Origin) and origin_or_str is f.f_locals.get('self'):
+ # Avoid adding log ctx in stack frame where Origin it is already "self",
+ # it is not needed and will make find_on_stack() to malfunction
+ raise Error('Don\'t use log.ctx(self), it\'s not needed!')
+ f.f_locals[LOG_CTX_VAR] = origin_or_str
class OriginLoopError(Error):
pass
diff --git a/src/osmo_gsm_tester/core/process.py b/src/osmo_gsm_tester/core/process.py
index 320f9ec..36ed057 100644
--- a/src/osmo_gsm_tester/core/process.py
+++ b/src/osmo_gsm_tester/core/process.py
@@ -196,7 +196,6 @@
self.terminate()
raise e
if raise_nonsuccess and self.result != 0:
- log.ctx(self)
raise log.Error('Exited in error %d' % self.result)
return self.result
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18657
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I4ab7e8977fa9bad5c8956b7c1df1513b27bb5aa2
Gerrit-Change-Number: 18657
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200604/612441e2/attachment.htm>