mirror of https://gerrit.osmocom.org/libosmocore
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
This commit is contained in:
parent
94e4265f07
commit
3385e4b0c4
|
@ -120,7 +120,8 @@ struct osmo_fsm_inst {
|
|||
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue