[asterisk-dev] [Code Review] 3185: Logger: Allow creation and removal of dynamic logger channels

Mark Michelson reviewboard at asterisk.org
Tue Feb 11 17:09:18 CST 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3185/#review10855
-----------------------------------------------------------



trunk/main/logger.c
<https://reviewboard.asterisk.org/r/3185/#comment20464>

    Since you are not modifying the contents of the logchannels list, you only need to AST_RWLIST_RDLOCK() it.



trunk/main/logger.c
<https://reviewboard.asterisk.org/r/3185/#comment20463>

    This if check can be simplified to
    
    if (chan->dynamic && (ast_strlen_zero(a->argv[3] || !strncmp(a->argv[3], chan->filename, strlen(a->argv[3])))
    
    The check for a->pos == 3 is unnecessary since you've already returned early if a->pos is greater than 3. The CLI_GENERATE case won't be called into if a->pos is less than 3.
    
    The check for strlen(a->argv[3]) <= strlen(chan->filename) is also unnecessary since strncmp will return non-zero if the length parameter is greater than the length of one of the input strings.
    
    The ast_strlen_zero(a->argv[3]) may be removable if it can be guaranteed that if a->pos == 3 then a->argv[3] is guaranteed to be non-NULL. I can't recall if that's a guarantee or not though.


- Mark Michelson


On Feb. 11, 2014, 5:13 p.m., opticron wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3185/
> -----------------------------------------------------------
> 
> (Updated Feb. 11, 2014, 5:13 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: AST-1150
>     https://issues.asterisk.org/jira/browse/AST-1150
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This adds the ability to dynamically add and remove logger channels from Asterisk via the CLI.
> 
> 
> Diffs
> -----
> 
>   trunk/main/logger.c 407954 
>   trunk/CHANGES 407954 
> 
> Diff: https://reviewboard.asterisk.org/r/3185/diff/
> 
> 
> Testing
> -------
> 
> Verified that the logs created this way showed up where expected containing the correct logging levels.
> 
> "logger add channel /tmp/testchannel warning,error,verbose,notice"
> "logger remove channel /tmp/testchannel"
> 
> 
> Thanks,
> 
> opticron
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140211/80f998b6/attachment-0001.html>


More information about the asterisk-dev mailing list