Slide 59
Slide 59 text
$log = new Monolog\Logger('my-app');
$streamHandler = new Monolog\Handler\StreamHandler('/tmp/app.log',
Monolog\Logger::DEBUG);
$fcHandler = new Monolog\Handler\FingersCrossedHandler($streamHandler,
Monolog\Logger::ERROR);
$log->pushHandler($fcHandler);
function countConsonants($str, $log){
$c = strlen(str_replace(['a','e','i','o','u'],'', $str));
$log->info("Consonants in {$str}: {$c}");
return $c;
}
echo countConsonants("Michael", $log);