Skip to content

Commit

Permalink
Add Monolog Frame -> Event mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Dec 16, 2023
1 parent 48a1d13 commit be62b67
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Sender/Frontend/FrameMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function map(Frame $frame): Event
Frame\Smtp::class => (new Mapper\Smtp())->map($frame),
Frame\Sentry\SentryStore::class => (new Mapper\SentryStore())->map($frame),
Frame\Sentry\SentryEnvelope::class => (new Mapper\SentryEnvelope())->map($frame),
Frame\Monolog::class => (new Mapper\Monolog())->map($frame),
default => throw new \InvalidArgumentException('Unknown frame type ' . $frame::class),
};
}
Expand Down
25 changes: 25 additions & 0 deletions src/Sender/Frontend/Mapper/Monolog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Buggregator\Trap\Sender\Frontend\Mapper;

use Buggregator\Trap\Proto\Frame\Monolog as MonologFrame;
use Buggregator\Trap\Sender\Frontend\Event;
use Buggregator\Trap\Support\Uuid;

/**
* @internal
*/
final class Monolog
{
public function map(MonologFrame $frame): Event
{
return new Event(
uuid: Uuid::uuid4(),
type: 'monolog',
payload: $frame->message,
timestamp: (float)$frame->time->format('U.u'),
);
}
}

0 comments on commit be62b67

Please sign in to comment.