Module: kamailio
Branch: master
Commit: 76e18d0d13a41e93094f9084ac44e0809f91b109
URL: 
https://github.com/kamailio/kamailio/commit/76e18d0d13a41e93094f9084ac44e0809f91b109

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-12-03T08:03:57+01:00

xlog: evaluate prefix for kemi functions

---

Modified: src/modules/xlog/xlog.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/76e18d0d13a41e93094f9084ac44e0809f91b109.diff
Patch: 
https://github.com/kamailio/kamailio/commit/76e18d0d13a41e93094f9084ac44e0809f91b109.patch

---

diff --git a/src/modules/xlog/xlog.c b/src/modules/xlog/xlog.c
index 98c6e49a0f9..f19d3c1467f 100644
--- a/src/modules/xlog/xlog.c
+++ b/src/modules/xlog/xlog.c
@@ -886,6 +886,7 @@ int ki_xlog_ex(sip_msg_t *msg, str *lfacility, int llevel, 
str *lmsg)
        int lf = xlog_facility;
        pv_elem_t *xmodel = NULL;
        str txt = {0, 0};
+       char *_xlog_prefix_val = _xlog_prefix;
 
        if(!is_printable(llevel))
                return 1;
@@ -901,6 +902,18 @@ int ki_xlog_ex(sip_msg_t *msg, str *lfacility, int llevel, 
str *lmsg)
                return -1;
        }
 
+       if(_xlog_prefix_mode) {
+               str _xlog_prefix_str;
+               _xlog_prefix_str.s = _xlog_prefix_buf;
+               _xlog_prefix_str.len = buf_size;
+               if(pv_printf(msg, _xlog_prefix_pvs, _xlog_prefix_str.s,
+                                  &_xlog_prefix_str.len)
+                                               == 0
+                               && _xlog_prefix_str.len > 0) {
+                       _xlog_prefix_val = _xlog_prefix_buf;
+               }
+       }
+
        if(lfacility != NULL) {
                lfacility->s[lfacility->len] = '\0';
                lf = str2facility(lfacility->s);
@@ -910,8 +923,7 @@ int ki_xlog_ex(sip_msg_t *msg, str *lfacility, int llevel, 
str *lmsg)
                        lf = xlog_facility;
                }
        }
-       LOG_FN(lf, llevel, _xlog_prefix, "%.*s", txt.len, txt.s);
-       ;
+       LOG_FN(lf, llevel, _xlog_prefix_val, "%.*s", txt.len, txt.s);
        pv_elem_free_all(xmodel);
        return 1;
 }

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to