You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by da...@hic.gov.au on 2001/12/11 00:40:29 UTC

Logkit: Logger.is[Priority]Enabled - suggested method.

I have been playing with LogKit (Playing is good).

With the deprecation of the getPriority() method of the Logger class, a
series of is[Priority]Enabled() methods were added.

May I suggest that 1 additional method is needed within the class and it
would look something like this:

    /**
     * Determine if messages of priority  will be logged.
     *
     * @return true if messages will be logged
     */
    public final boolean isEnabled(Priority p)
    {
        return getPriority().isLowerOrEqual( p );
    }

I think that this would complement the existing is[]Enabled() methods
without breaking IOC and provide a little more flexibility.

Any comments - anyone?



****************************************************************
NOTICE - This message is intended only for the use of the 
addressee named above and may contain privileged and 
confidential information.  If you are not the intended recipient
of this message you are hereby notified that you must not 
disseminate, copy or take any action based upon it.  If you 
received this message in error please notify HIC immediately.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of HIC.
****************************************************************

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logkit: Logger.is[Priority]Enabled - suggested method.

Posted by Peter Donald <pe...@apache.org>.
Works for me. I just committed a modified version of your suggestion - namely 
I used method name isPriorityEnabled().

Thanks!

On Tue, 11 Dec 2001 10:40, david.gray@hic.gov.au wrote:
> I have been playing with LogKit (Playing is good).
>
> With the deprecation of the getPriority() method of the Logger class, a
> series of is[Priority]Enabled() methods were added.
>
> May I suggest that 1 additional method is needed within the class and it
> would look something like this:
>
>     /**
>      * Determine if messages of priority  will be logged.
>      *
>      * @return true if messages will be logged
>      */
>     public final boolean isEnabled(Priority p)
>     {
>         return getPriority().isLowerOrEqual( p );
>     }
>
> I think that this would complement the existing is[]Enabled() methods
> without breaking IOC and provide a little more flexibility.
>
> Any comments - anyone?
>
>
>
> ****************************************************************
> NOTICE - This message is intended only for the use of the
> addressee named above and may contain privileged and
> confidential information.  If you are not the intended recipient
> of this message you are hereby notified that you must not
> disseminate, copy or take any action based upon it.  If you
> received this message in error please notify HIC immediately.
> Any views expressed in this message are those of the individual
> sender, except where the sender specifically states them to be
> the views of HIC.
> ****************************************************************

-- 
Cheers,

Pete

----------------------------------------------------------------
Fools ignore complexity.  Pragmatists suffer it.
Some can avoid it.  Geniuses remove it.
-- Perlis's Programming Proverb #58, SIGPLAN Notices, Sept. 1982
----------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logkit: Logger.is[Priority]Enabled - suggested method.

Posted by Jeff Turner <je...@socialchange.net.au>.
On Tue, Dec 11, 2001 at 10:02:32PM +1100, Jeff Turner wrote:
> >     /**
> >      * Determine if messages of priority  will be logged.
> >      *
> >      * @return true if messages will be logged
> >      */
> >     public final boolean isEnabled(Priority p)
> >     {
> >         return getPriority().isLowerOrEqual( p );
> >     }
> 
> Isn't that logic backwards? If getPriority has a LOWER priority (eg
> DEBUG) that p's (eg WARN), then logging is disabled, not enabled.

Nevermind me.. misunderstood.. it's correct. 

--Jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logkit: Logger.is[Priority]Enabled - suggested method.

Posted by Jeff Turner <je...@socialchange.net.au>.
On Tue, Dec 11, 2001 at 10:40:29AM +1100, david.gray@hic.gov.au wrote:
> 
> I have been playing with LogKit (Playing is good).
> 
> With the deprecation of the getPriority() method of the Logger class, a
> series of is[Priority]Enabled() methods were added.
> 
> May I suggest that 1 additional method is needed within the class and it
> would look something like this:
> 
>     /**
>      * Determine if messages of priority  will be logged.
>      *
>      * @return true if messages will be logged
>      */
>     public final boolean isEnabled(Priority p)
>     {
>         return getPriority().isLowerOrEqual( p );
>     }

Isn't that logic backwards? If getPriority has a LOWER priority (eg
DEBUG) that p's (eg WARN), then logging is disabled, not enabled.


--Jeff

> I think that this would complement the existing is[]Enabled() methods
> without breaking IOC and provide a little more flexibility.
> 
> Any comments - anyone?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>