Skip to content

Instantly share code, notes, and snippets.

@matheusfaustino
Created September 27, 2018 13:25
Show Gist options
  • Save matheusfaustino/56e872d12f1baebce01e34489ac68580 to your computer and use it in GitHub Desktop.
Save matheusfaustino/56e872d12f1baebce01e34489ac68580 to your computer and use it in GitHub Desktop.
Monolog stdout and file log
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
require './vendor/autoload.php';
// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('your.log', Logger::WARNING));
$log->pushHandler(new \Monolog\Handler\ErrorLogHandler());
// add records to the log
$log->warning('Foo');
$log->error('Bar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment