Its a performance enhancement.

No point in instantiating the logger if it's not going to be used!

Fail fast and get better performance ;)

Also, logging can then be enabled and disabled on a more fine grained  
level, you may choose to log in a class regardless of whether logging  
in the entire application is switched on or off (useful for isolating  
some problems so you don't get reams of useless log information you  
are not interested in).

On 23 Jan 2009, at 15:33, Yohan 'rouKs' G. wrote:

> Hi all,
>
> I'm using the sf(1.2) logging system in an application, and I don't
> understand why we have to check if logging is active, ex :
>
> if (sfConfig::get('sf_logging_enabled'))
> {
>  sfContext::getInstance()->getLogger()->info($message);
> }
>
>
> Why the test isn't in the logger himself ?
>
> Thanks,
>
> yohan g.
>
> >
> begin:vcard
> fn:Yohan 'rouKs' GIARELLI
> n:GIARELLI;Yohan
> email;internet:[email protected]
> x-mozilla-html:TRUE
> version:2.1
> end:vcard
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to