[Devel] xlog patch for openser stable (0.9.4)
Daniel-Constantin Mierla
daniel at voice-system.ro
Wed Jun 22 11:53:36 CEST 2005
Hello Ingo,
that was introduced by me, I thought that makes no sense to write the
escape sequences to syslog, being a text file. The extra parameter makes
sense for those that want to enforce colors to syslog.
Daniel
On 06/21/05 21:58, Ingo Wolfsberger wrote:
>Hello Daniel,
>
>It tooks me about 1hour to figure out why xlog was broken and does not print
>colors into xlog......
>
>So, i have written another patch with an xlog parameter (col_mode) to be
>able to enable xlog colors in syslog.
>
>see the attached patch.
>
>bye,
> Ingo
>
>
>
>
>>thanks for the patch. It is now on CVS.
>>
>>Daniel
>>
>>
>>On 06/19/05 04:54, Ingo Wolfsberger wrote:
>>
>>
>>
>>>Hi
>>>
>>>
>>>
>>>
>>>
>>>>I have applied the patch with some modifications to openser CVS head.
>>>>The specifier is same %Cxy, but both foreground and background have to
>>>>be specified to avoid ambiguities, for example:
>>>>%Cbrequest-uri=[%ru] would have printed blue on red 'equest-uri=...'
>>>>
>>>>
>>>>
>>>>
>>>Yes, better to do that strict.
>>>
>>>
>>>
>>>
>>>
>>>>When you don't want to change a color, use 'x' which means default
>>>>terminal color (code 39 for foreground and 49 for background, taken from
>>>>linux man console_codes -- other OS should be tested in the future).
>>>>Readme updated, the sgml in the near future.
>>>>
>>>>
>>>>
>>>>
>>>I have found some cosmetic bugs (my own ones) and one a only little bit
>>>
>>>
>>more
>>
>>
>>>important one.
>>>The diff is attached.
>>>
>>>Thanks for integration.
>>>
>>>bye,
>>> Ingo
>>>
>>>
>>>
>>>
>>>
>
>
>
>------------------------------------------------------------------------
>
>? sip-server/modules/xlog/xl_lib.c_org
>? sip-server/modules/xlog/xlog.h
>Index: sip-server/modules/xlog/README
>===================================================================
>RCS file: /cvsroot/openser/sip-server/modules/xlog/README,v
>retrieving revision 1.2
>diff -u -r1.2 README
>--- sip-server/modules/xlog/README 18 Jun 2005 11:32:27 -0000 1.2
>+++ sip-server/modules/xlog/README 21 Jun 2005 18:53:46 -0000
>@@ -27,6 +27,7 @@
> 1.4. Exported Parameters
>
> 1.4.1. buf_size (integer)
>+ 1.4.2. col_mode (integer)
>
> 1.5. Exported Functions
>
>@@ -38,8 +39,9 @@
>
> List of Examples
> 1-1. Set buf_size parameter
>- 1-2. xlog usage
>- 1-3. xdbg usage
>+ 1-2. Set col_mode parameter
>+ 1-3. xlog usage
>+ 1-4. xdbg usage
> _________________________________________________________
>
> Chapter 1. User's Guide
>@@ -166,6 +168,20 @@
> ...
> _________________________________________________________
>
>+1.4.2. col_mode (integer)
>+
>+ Change type of color mode in xlog.
>+ 0: do not print color into syslog
>+ 1: print color into syslog
>+
>+ Default: 0
>+
>+ Example 1-2. Set col_mode parameter
>+...
>+modparam("xlog", "col_mode", 1)
>+...
>+ _________________________________________________________
>+
> 1.5. Exported Functions
>
> 1.5.1. xlog(level, format)
>@@ -186,7 +202,7 @@
> What really matters is the third letter of the value.
> * format - The formatted string to be printed.
>
>- Example 1-2. xlog usage
>+ Example 1-3. xlog usage
> ...
> xlog("L_ERR", "time [%Tf] method <%rm> r-uri <%ru> 2nd via <%{via[1]}>\
> n");
>@@ -201,7 +217,7 @@
>
> * format - The formatted string to be printed.
>
>- Example 1-3. xdbg usage
>+ Example 1-4. xdbg usage
> ...
> xdbg("time [%Tf] method <%rm> r-uri <%ru>\n");
> ...
>Index: sip-server/modules/xlog/xl_lib.c
>===================================================================
>RCS file: /cvsroot/openser/sip-server/modules/xlog/xl_lib.c,v
>retrieving revision 1.5
>diff -u -r1.5 xl_lib.c
>--- sip-server/modules/xlog/xl_lib.c 20 Jun 2005 14:47:03 -0000 1.5
>+++ sip-server/modules/xlog/xl_lib.c 21 Jun 2005 18:53:46 -0000
>@@ -49,6 +49,7 @@
> #include "../../parser/parse_hname2.h"
> #include "../../parser/parse_refer_to.h"
>
>+#include "xlog.h"
> #include "xl_lib.h"
>
> static str str_null = { "<null>", 6 };
>@@ -1448,7 +1449,7 @@
> }
> /* put the value of the specifier */
> if(it->itf
>- && ((*it->itf != xl_get_color) || (log_stderr!=0))
>+ && ((*it->itf != xl_get_color) || (log_stderr!=0) || (col_mode!=0))
> && !((*it->itf)(msg, &tok, &(it->hparam), it->hindex)))
> {
> if(n+tok.len < *len)
>Index: sip-server/modules/xlog/xlog.c
>===================================================================
>RCS file: /cvsroot/openser/sip-server/modules/xlog/xlog.c,v
>retrieving revision 1.1.1.1
>diff -u -r1.1.1.1 xlog.c
>--- sip-server/modules/xlog/xlog.c 13 Jun 2005 16:47:48 -0000 1.1.1.1
>+++ sip-server/modules/xlog/xlog.c 21 Jun 2005 18:53:46 -0000
>@@ -34,6 +34,7 @@
> #include "../../error.h"
> #include "../../mem/mem.h"
>
>+#include "xlog.h"
> #include "xl_lib.h"
>
>
>@@ -43,6 +44,7 @@
>
> /** parameters */
> int buf_size=4096;
>+int col_mode = 0;
>
> /** module functions */
> static int mod_init(void);
>@@ -67,6 +69,7 @@
>
> static param_export_t params[]={
> {"buf_size", INT_PARAM, &buf_size},
>+ {"col_mode", INT_PARAM, &col_mode},
> {0,0,0}
> };
>
>
>
More information about the Devel
mailing list