-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpiraApplication.php
52 lines (45 loc) · 1.37 KB
/
SpiraApplication.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
* This file is part of the Spira framework.
*
* @link https://github.com/spira/spira
*
* For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
*/
namespace Spira\Core;
use Laravel\Lumen\Application;
use Monolog\Handler\SyslogUdpHandler;
class SpiraApplication extends Application
{
/**
* Set the error handling for the application.
*
* @return void
*/
protected function registerErrorHandling()
{
parent::registerErrorHandling();
// Don't display additional errors on top of the exception being rendered
// @codeCoverageIgnoreStart
ini_set('display_errors', 0);
if ('cli' !== php_sapi_name() && (! ini_get('log_errors') || ini_get('error_log'))) {
// CLI - display errors only if they're not already logged to STDERR
ini_set('display_errors', 1);
}
// @codeCoverageIgnoreEnd
}
/**
* Get the Monolog handler for the application.
*
* @return \Monolog\Handler\AbstractHandler
*/
protected function getMonologHandler()
{
// @codeCoverageIgnoreStart
if (env('LOG_UDP_HOST')) {
return new SyslogUdpHandler(env('LOG_UDP_HOST'), env('LOG_UDP_PORT'));
}
return parent::getMonologHandler();
// @codeCoverageIgnoreEnd
}
}