Skip to content

Commit fb9e41d

Browse files
committed
feat(core): log exceptions
1 parent c4a9237 commit fb9e41d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

packages/core/src/LogExceptionProcessor.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22

33
namespace Tempest\Core;
44

5-
use Tempest\Debug\Debug;
5+
use Tempest\Log\Logger;
66
use Throwable;
77

8+
use function Tempest\get;
9+
810
/**
911
* An exception processor that logs exceptions.
1012
*/
1113
final class LogExceptionProcessor implements ExceptionProcessor
1214
{
1315
public function process(Throwable $throwable): Throwable
1416
{
15-
$items = [
16-
'exception' => $throwable->getMessage(),
17-
'context' => ($throwable instanceof HasContext)
18-
? $throwable->context()
19-
: [],
20-
];
21-
22-
Debug::resolve()->log($items, writeToOut: false);
17+
get(Logger::class)
18+
?->error(
19+
$throwable->getMessage(),
20+
[
21+
'exception' => $throwable,
22+
],
23+
);
2324

2425
return $throwable;
2526
}

0 commit comments

Comments
 (0)