Re: [siesta-dev] broken log function

[prev] [thread] [next] [lurker] [Date index for 2004/09/27]

From: Richard Clamp
Subject: Re: [siesta-dev] broken log function
Date: 09:43 on 27 Sep 2004
On 26 Sep 2004, at 02:24, Mark D. Anderson wrote:

> Unless I'm unusually dyslexic today, function log() in Siesta.pm
> should not be:
>
>     print $logger "$date $message $level\n"
>       if $level >= $config->log_level;
>
> either that "if" should be an "unless", or that ">=" should
> be a "<=".

Probably, but there don't seem to be tests, so the feature doesn't 
exist, faulty or not.

> <rant>
> also, why that particular argument structure for the
> log function? why not ($self, $level, @message) like
> every other log function on the planet?

What if you don't know what level this is?  The benefit of this calling 
convention seems to be you can do less typing, so instead of going 
$foo->log( "um, what's the default log level again?", "my default level 
log message" ); you can just say $foo->log( "my default log level 
message" );

That said, I don't actually care, if you write the patch to change all 
7 references to log in the code, a patch which would of course take 
fewer lines than your ill-considered 'rant', then I'm sure it would get 
applied.

> and why name the function "log" for that matter,
> when there is a builtin function by that name
> that takes the natural logarithm?

Suggest a better name, in a patch.

> oh, and what's the point of $CONFIG_FILE in Config.pm
> that nobody pays any attention to -- for example
> if somebody wanted to actually change the value
> of, say, log_level....
> </rant>

You're mistaken, it's very much paid attention to; you're probably just 
not setting it early enough.

> thanks....
>
> -mda
>
>
>
-- 
Richard Clamp <richardc@xxxxxxxxx.xxx>

Generated at 22:00 on 09 Oct 2004 by mariachi 0.52