Change in libosmocore[master]: fsm: Change semantics of LOGPFSML() log-level

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jun 8 10:22:41 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9420 )

Change subject: fsm: Change semantics of LOGPFSML() log-level
......................................................................

fsm: Change semantics of LOGPFSML() log-level

The general idea about each osmo_fsm_instance having a separate
log-level was to be able to selectively increase/show/enable logging
for some FSM instances (e.g. of a particular subscriber) while
maintaining normal logging verbosity for all other instances of the
same FSM.

The introduction of LOGPFSML() in Change-Id
If295fdabb3f31a0fd9490d1e0df57794c75ae547 broke that idea, as it would
use a compile-time log level, irrespective of the
osmo_fsm_inst.log_level setting of the given instance.

Let's combine the two:
Use the explicit level stated at LOGPFSML(), _unless_ this instance
has a higher log_level configured.

This way, all FSMs should normally be created with
osmo_fsm_inst.log_level == LOGL_DEBUG.  At that point LOGPFSM()
statements would be rendered at debug level, typically below the
threshold of most logging configurations.

Code that has explicit higher log levels like LOGPFSML(fi, LOGL_ERROR)
would always be printed, as it is an error message.

And if we now increase the osmo_fsm_inst.log_level, then even the normal
LOGPFSM() statements would suddenly be logged at that higher level,
selectively increasing log verbosity - like originally intended.

Change-Id: I1820f04d0c6f5d5ff08eb95b8c0e88764534491a
---
M include/osmocom/core/fsm.h
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h
index 67e00ad..9e1062f 100644
--- a/include/osmocom/core/fsm.h
+++ b/include/osmocom/core/fsm.h
@@ -120,7 +120,8 @@
 void osmo_fsm_log_addr(bool log_addr);
 
 #define LOGPFSML(fi, level, fmt, args...) \
-		LOGP((fi)->fsm->log_subsys, level, "%s{%s}: " fmt, \
+		LOGP((fi)->fsm->log_subsys, OSMO_MAX(level, (fi)->log_level), \
+			"%s{%s}: " fmt, \
 			osmo_fsm_inst_name(fi),				    \
 			osmo_fsm_state_name((fi)->fsm, (fi)->state), ## args)
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1820f04d0c6f5d5ff08eb95b8c0e88764534491a
Gerrit-Change-Number: 9420
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180608/ceb6b286/attachment.htm>


More information about the gerrit-log mailing list