Created
May 13, 2013 07:34
-
-
Save odino/5566716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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