-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlogger.php
More file actions
29 lines (23 loc) · 707 Bytes
/
logger.php
File metadata and controls
29 lines (23 loc) · 707 Bytes
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
<?php
declare(strict_types=1);
/**
* @author Mougrim <rinat@mougrim.ru>
*/
namespace Mougrim\XdebugProxy\config;
use Amp\Log\StreamHandler;
use Monolog\Logger;
use Mougrim\XdebugProxy\LoggerFormatter;
use Mougrim\XdebugProxy\RunError;
use Psr\Log\LogLevel;
use function Amp\ByteStream\getStdout;
use function class_exists;
if (!class_exists(StreamHandler::class)) {
throw new RunError(
'You should install "amphp/log" by default or provide your custom config/logger.php via config for use php-xdebug-proxy'
);
}
return (new Logger('xdebug-proxy'))
->pushHandler(
(new StreamHandler(getStdout(), LogLevel::NOTICE))
->setFormatter(new LoggerFormatter())
);