Module: kamailio
Branch: master
Commit: 89cc5ddeebd7cb900aff8000a7593f5c52b880ff
URL:
https://github.com/kamailio/kamailio/commit/89cc5ddeebd7cb900aff8000a7593f5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-07-31T17:17:46+02:00
core: helper function to get debug level for logging from config
---
Modified: src/core/dprint.c
Modified: src/core/dprint.h
---
Diff:
https://github.com/kamailio/kamailio/commit/89cc5ddeebd7cb900aff8000a7593f5…
Patch:
https://github.com/kamailio/kamailio/commit/89cc5ddeebd7cb900aff8000a7593f5…
---
diff --git a/src/core/dprint.c b/src/core/dprint.c
index 46d69a1f97..1b180474c1 100644
--- a/src/core/dprint.c
+++ b/src/core/dprint.c
@@ -169,6 +169,16 @@ int get_debug_level(char *mname, int mnlen) {
_local_debug_level : cfg_get(core, core_cfg, debug);
}
+/**
+ * @brief return the log level - the local one if it set,
+ * otherwise the global value
+ */
+int get_cfg_debug_level(void) {
+ /*important -- no LOGs inside, because it will loop */
+ return (_local_debug_level != UNSET_LOCAL_DEBUG_LEVEL) ?
+ _local_debug_level : cfg_get(core, core_cfg, debug);
+}
+
/**
* @brief return the log facility - the local one if it set,
* otherwise the global value
diff --git a/src/core/dprint.h b/src/core/dprint.h
index 8a7a283875..c3096c5555 100644
--- a/src/core/dprint.h
+++ b/src/core/dprint.h
@@ -141,6 +141,7 @@ struct log_level_info {
/** @brief per process debug level handling */
int get_debug_level(char *mname, int mnlen);
+int get_cfg_debug_level(void);
int get_debug_facility(char *mname, int mnlen);
void set_local_debug_level(int level);
void set_local_debug_facility(int facility);