Harald Welte has submitted this change and it was merged.

Change subject: logging: Extend the LOGPSRC macro to put cont in it as well
......................................................................


logging: Extend the LOGPSRC macro to put cont in it as well

For the lua console printing I need to print several values with
continuation but also specify the filename. Add a "C" for continue
and forward arguments.

Change-Id: I1d6dcb2567b9ed2c8767f661737b979bc3d1377e
---
M include/osmocom/core/logging.h
1 file changed, 18 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 86a6977..922cbf6 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -71,12 +71,28 @@
  *  \param[in] args variable argument list
  */
 #define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \
+       LOGPSRCC(ss, level, caller_file, caller_line, 0, fmt, ##args)
+
+/*! Log through the Osmocom logging framework with explicit source.
+ *  If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used
+ *  instead of caller_file and caller_line (so that this macro here defines
+ *  both cases in the same place, and to catch cases where callers fail to pass
+ *  a non-null filename string).
+ *  \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
+ *  \param[in] level logging level (e.g. \ref LOGL_NOTICE)
+ *  \param[in] caller_file caller's source file string (e.g. __BASE_FILE__)
+ *  \param[in] caller_line caller's source line nr (e.g. __LINE__)
+ *  \param[in] cont continuation (1) or new line (0)
+ *  \param[in] fmt format string
+ *  \param[in] args variable argument list
+ */
+#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \
        do { \
                if (log_check_level(ss, level)) {\
                        if (caller_file) \
-                               logp2(ss, level, caller_file, caller_line, 0, 
fmt, ##args); \
+                               logp2(ss, level, caller_file, caller_line, 
cont, fmt, ##args); \
                        else \
-                               logp2(ss, level, __BASE_FILE__, __LINE__, 0, 
fmt, ##args); \
+                               logp2(ss, level, __BASE_FILE__, __LINE__, cont, 
fmt, ##args); \
                }\
        } while(0)
 

-- 
To view, visit https://gerrit.osmocom.org/5080
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1d6dcb2567b9ed2c8767f661737b979bc3d1377e
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to