[sr-dev] app_python: expanding log facilities

Daniel-Constantin Mierla miconda at gmail.com
Tue Dec 4 18:24:13 CET 2012


Hello,

app_python didn't not have really a maintainer in the past years. If 
nobody from existing developers is willing to take over the 
maintenance/development of the module, then you can join and take care 
of it, committing directly. You will have to do it for at least one year.

Let us know if it would interest you.

Cheers,
Daniel

On 12/4/12 6:14 PM, Konstantin M. wrote:
> Hello,
>
> Added Module Properties:
>   Ranks:
>       PROC_MAIN        - Main ser process
>       PROC_TIMER        - Timer attendant process
>       PROC_RPC        - RPC type process
>       PROC_FIFO        - FIFO attendant process
>       PROC_TCP_MAIN    - TCP main process
>       PROC_UNIXSOCK    - Unix socket server
>       PROC_ATTENDANT    - main "attendant" process
>       PROC_INIT        - special rank, the context is the main ser
>                                process, but this is guaranteed to be 
> executed
>                                before any process is forked, so it can 
> be used
>                                to setup shared variables that depend 
> on some
>                                after mod_init available information (e.g.
>                                total number of processes).
>
>                                @warning child_init(PROC_MAIN) is again 
> called
>                 in the same process (main), but latter
>                                (before tcp), so make sure you don't 
> init things
>                                twice, bot in PROC_MAIN and PROC_INT
>
>       PROC_NOCHLDINIT    - no child init functions will be called if 
> this rank is used in fork_process()
>       PROC_SIPINIT        - First SIP worker - some modules do special 
> processing in this child, like loading db data
>       PROC_SIPRPC        - Used to init RPC worker as SIP commands 
> handler. Don't do any special processing in the
>                 child init with this rank - just bare child initialization
>       PROC_MIN        - Minimum process rank
>
> Diff is attached.
>
> 2012/12/4 Ovidiu Sas <osas at voipembedded.com 
> <mailto:osas at voipembedded.com>>
>
>     Second patch applied.
>
>     Thanks,
>     Ovidiu
>
>     On Mon, Dec 3, 2012 at 7:22 PM, Konstantin M. <evilzluk at gmail.com
>     <mailto:evilzluk at gmail.com>> wrote:
>     > Sure, done, see 02_better_printing_stacktrace.diff  attached.
>     >
>     >
>     > 2012/12/4 Ovidiu Sas <osas at voipembedded.com
>     <mailto:osas at voipembedded.com>>
>     >>
>     >> 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 <mailto: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
>     <mailto: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 <mailto: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 <mailto:sr-dev at lists.sip-router.org>
>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20121204/bc8b92b2/attachment.htm>


More information about the sr-dev mailing list