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

opticron reviewboard at asterisk.org
Tue Feb 11 19:12:24 CST 2014



> On Feb. 11, 2014, 5:09 p.m., Mark Michelson wrote:
> > trunk/main/logger.c, lines 1079-1083
> > <https://reviewboard.asterisk.org/r/3185/diff/4/?file=53838#file53838line1079>
> >
> >     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.

a->argv[3] can apparently be NULL.


- opticron


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


On Feb. 11, 2014, 11:13 a.m., opticron wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3185/
> -----------------------------------------------------------
> 
> (Updated Feb. 11, 2014, 11:13 a.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/20140212/a6770210/attachment.html>


More information about the asterisk-dev mailing list