[sr-dev] app_python: expanding log facilities

Ovidiu Sas osas at voipembedded.com
Tue Dec 4 00:38:14 CET 2012


Hello Konstantin,

I applied the first patch.  Thank you.
For the second patch, I would like to use the internal kamailio memory
manager: pkg_malloc and pkg_realloc instead of calloc and realloc.
Could you please rework the second patch and test?

Thanks,
Ovidiu

On Mon, Dec 3, 2012 at 6:14 PM, Konstantin M. <evilzluk at gmail.com> wrote:
> 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)
>> >



More information about the sr-dev mailing list