Skip to content

Instantly share code, notes, and snippets.

@kaioken kaioken/service.php
Created Oct 27, 2018

What would you like to do?
PhalconPHP Integration with Monolog
* System Log using monolog
$di->set('log', function ($file = 'debug') use ($config, $di) {
// Create the logger
$logger = new MonoLogger('GEWAER.API');
$client = new Raven_Client('https://' . getenv('SENTRY_RPOJECT_SECRET') . '' . getenv('SENTRY_PROJECT_ID'));
//only report error logs to sentry
$handler = new Monolog\Handler\RavenHandler($client, MonoLogger::ERROR);
$handler->setFormatter(new Monolog\Formatter\LineFormatter("%message% %context% %extra%\n"));
$logger->pushHandler(new StreamHandler(APP_PATH . '/logs/' . $file . '.log', Logger::DEBUG));
return $logger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.