Created
October 27, 2018 05:52
-
-
Save kaioken/b8eabd2d2144989842f7ef38809e418d to your computer and use it in GitHub Desktop.
PhalconPHP Sentry.io Integration with Monolog
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 | |
| /** | |
| * 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') . '@sentry.io/' . 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($handler); | |
| $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