Skip to content

Instantly share code, notes, and snippets.

@odino
Created May 13, 2013 07:34
Show Gist options
  • Save odino/5566716 to your computer and use it in GitHub Desktop.
Save odino/5566716 to your computer and use it in GitHub Desktop.
<?php
namespace Psr\Log;
interface Loggable
{
public function getContext();
}
class Car implements Loggable
{
public function getContext()
{
return array(
'plate_number' => $this->getPlateNumber(),
'model' => $this->getModel(),
);
}
}
// userland code
if ($car->turnsOn()) {
$logger->info("Hey today the car turned on!", $car);
} else {
$logger->err("Hmmm...", $car);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment