Overview

A Slim application provides a log object that writes data to a specific output. The actual writing of data isdelegated to a log writer.

How to log data

To log data in a Slim application, get a reference to the log object:

  1. <?php
  2. $log = $app->log;

The log object provides the following PSR-3 interface

  1. $app->log->debug(mixed $object);
  2. $app->log->info(mixed $object);
  3. $app->log->notice(mixed $object);
  4. $app->log->warning(mixed $object);
  5. $app->log->error(mixed $object);
  6. $app->log->critical(mixed $object);
  7. $app->log->alert(mixed $object);
  8. $app->log->emergency(mixed $object);

Each log object method accepts one mixed argument. The argument is usually a string, but the argument can beanything. The log object will pass the argument to its log writer. It is the log writer’s responsibility to writearbitrary input to the appropriate destination.