Slide 57
Slide 57 text
$log = new Monolog\Logger('casino-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);