[sr-dev] app_python: expanding log facilities

Konstantin M. evilzluk at gmail.com
Tue Dec 4 00:14:48 CET 2012


Hello Ovidiu Sas,
Sure, I just removed this, see 01_expand_log_facilities.diff attached.
Also I changed a printing of stack trace (see
02_better_printing_stacktrace.diff) according to standard python's
traceback.

Example of old printing:
 0(4842) ERROR: app_python [python_support.c:38]: python_exec2: Unhandled
exception in the Python code:
 0(4842) ERROR: app_python [python_support.c:78]:       Traceback (most
recent call last):
 0(4842) ERROR: app_python [python_support.c:78]:         File
"/opt/kamailio/python/Kam-Loggers.py", line 34, in BuggyCode
    return self.BuggyCode_lvl2(a)
 0(4842) ERROR: app_python [python_support.c:78]:         File
"/opt/kamailio/python/Kam-Loggers.py", line 31, in BuggyCode_lvl2
    return self.BuggyCode_lvl3(a)
 0(4842) ERROR: app_python [python_support.c:78]:         File
"/opt/kamailio/python/Kam-Loggers.py", line 28, in BuggyCode_lvl3
    return self.BuggyCode_lvl4(a)
 0(4842) ERROR: app_python [python_support.c:78]:         File
"/opt/kamailio/python/Kam-Loggers.py", line 25, in BuggyCode_lvl4
    return self.BuggyCode_lvl5(a)
 0(4842) ERROR: app_python [python_support.c:78]:         File
"/opt/kamailio/python/Kam-Loggers.py", line 22, in BuggyCode_lvl5
    a / 0
 0(4842) ERROR: app_python [python_support.c:78]:       TypeError:
unsupported operand type(s) for /: 'Router.msg' and 'int'


Example of new printing:
 0(4753) ERROR: app_python [python_support.c:95]: python_exec2: Unhandled
exception in the Python code:
Traceback (most recent call last):
  File "/opt/kamailio/python/Kam-Loggers.py", line 34, in BuggyCode
    return self.BuggyCode_lvl2(a)
  File "/opt/kamailio/python/Kam-Loggers.py", line 31, in BuggyCode_lvl2
    return self.BuggyCode_lvl3(a)
  File "/opt/kamailio/python/Kam-Loggers.py", line 28, in BuggyCode_lvl3
    return self.BuggyCode_lvl4(a)
  File "/opt/kamailio/python/Kam-Loggers.py", line 25, in BuggyCode_lvl4
    return self.BuggyCode_lvl5(a)
  File "/opt/kamailio/python/Kam-Loggers.py", line 22, in BuggyCode_lvl5
    a / 0
TypeError: unsupported operand type(s) for /: 'Router.msg' and 'int'



2012/12/4 Ovidiu Sas <osas at voipembedded.com>

> Hello Konstantin,
>
> I would be happy to commit your patch, but I would like to ask you to
> remove, for now, the conditional FLAVOUR compilation.
> You could leave the module name as "Router" for now.
> Can you generate an new patch file without FLAVOUR?
>
> Regards,
> Ovidiu Sas
>
> On Mon, Dec 3, 2012 at 2:50 PM, Konstantin M. <evilzluk at gmail.com> wrote:
> > Hi Dev,
> >
> > Modified app_python:
> >
> > 1) Added FLAVOUR support
> > 2) Added python objects:
> >
> >   Module Properties:
> >      Log Levels:
> >          L_ALERT
> >          L_BUG
> >          L_CRIT2
> >          L_CRIT
> >          L_ERR
> >          L_WARN
> >          L_NOTICE
> >          L_INFO
> >          L_DBG
> >
> >      Log Facilities:
> >          DEFAULT_FACILITY
> >
> >   Module Methods:
> >      LM_GEN1(self, int log_level, str msg)
> >      LM_GEN2(self, int log_facility, int log_level, str msg)
> >      LM_ALERT(self, str msg)
> >      LM_CRIT(self, str msg)
> >      LM_ERR(self, str msg)
> >      LM_WARN(self, str msg)
> >      LM_NOTICE(self, str msg)
> >      LM_INFO(self, str msg)
> >      LM_DBG(self, str msg)
> >
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20121204/4b34a274/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01_expand_log_facilities.diff
Type: application/octet-stream
Size: 9278 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20121204/4b34a274/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 02_better_printing_stacktrace.diff
Type: application/octet-stream
Size: 2507 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20121204/4b34a274/attachment-0003.obj>


More information about the sr-dev mailing list