Activate

The Slim application’s log object provides the following public methods to enable or disable logging during runtime.

  1. <?php
  2. //Enable logging
  3. $app->log->setEnabled(true);
  4. //Disable logging
  5. $app->log->setEnabled(false);

You may enable or disable the log object during application instantiation like this:

  1. <?php
  2. $app = new Slim(array(
  3. 'log.enabled' => true
  4. ));

If logging is disabled, the log object will ignore all logged messages until it is enabled.