How to gracefully disable a PHP logging class
<p>So i've got this logger (actually a wrapper), which is accessed all over the app with <code>Log::getInstance()-&gt;log_this</code> or <code>-&gt;log_that</code>, etc.  There is a config param in an ini which turns logging off, but the implementation to disable LogWrapper isn't quite right:</p>

<pre><code>private function __construct() {
    if(config::get('logging_enabled')) {
            $this-&gt;logger = new Log();
        } 
        //else?
}

public static function getInstance() {
    if(self::$_instance == NULL) {
        self::$_instance = new LogWrapper();
    }
    return self::$_instance;
}
</code></pre>

<p>Calls to <code>getInstance()-&gt;any_method</code> delegate to the $logger instance, but will fail because $logger isn't anything.</p>

<p>Where can i stop this flow <strong>within this class</strong>?  It's not an option to modify the Log class, nor can i go through each call in the app to LogWrapper.  I can't seem to get my head around this, and  I know one smartly-placed line would fix it...</p>

<p>thanks for any help!</p>
