Skip to content

Commit 908367d

Browse files
committed
Drop it from the tap
1 parent 42e454c commit 908367d

File tree

1 file changed

+2
-36
lines changed

1 file changed

+2
-36
lines changed

src/MonologTap.php

+2-36
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,19 @@ class MonologTap
1515
/**
1616
* Customize the given logger instance.
1717
*/
18-
public function __invoke(Logger $logger): void
18+
public function __invoke(Logger &$logger): void
1919
{
2020
$this->setStechFormatter($logger);
21-
22-
$this->setDefaultContext($logger);
2321
}
2422

2523
/**
2624
* Sets up the key=value, pair format that we like best
2725
*/
28-
public function setStechFormatter(Logger $logger): void
26+
public function setStechFormatter(Logger &$logger): void
2927
{
3028
$formatter = new MonologFormatter;
3129
foreach ($logger->getHandlers() as $handler) {
3230
$handler->setFormatter($formatter);
3331
}
3432
}
35-
36-
/**
37-
* Sets up a series of standardized contexts for us.
38-
*/
39-
public function setDefaultContext(Logger $logger): void
40-
{
41-
$logger->pushProcessor(function ($record) {
42-
if (! in_array($record['channel'], ['local', 'staging', 'production', 'lumen'])) {
43-
$record['context']['channel'] = $record['channel'];
44-
}
45-
// Add some core parameters
46-
if (array_key_exists('HTTP_HOST', $_SERVER)) {
47-
$record['context']['httpHost'] = $_SERVER['HTTP_HOST'];
48-
} else {
49-
$record['context']['httpHost'] = 'CLI';
50-
}
51-
if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
52-
$record['context']['IP'] = $_SERVER['REMOTE_ADDR'];
53-
}
54-
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
55-
$record['context']['IP'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
56-
}
57-
$record['context']['transactionID'] = uniqid();
58-
if (array_key_exists('CORRELATION_ID', $_ENV)) {
59-
$record['context']['correlationID'] = $_ENV['CORRELATION_ID'];
60-
}
61-
if (! env('PLANROOM_HOST', false)) {
62-
$record['context']['planroomHost'] = env('PLANROOM_HOST');
63-
}
64-
return $record;
65-
});
66-
}
6733
}

0 commit comments

Comments
 (0)