-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
31 lines (24 loc) · 717 Bytes
/
index.php
File metadata and controls
31 lines (24 loc) · 717 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
30
31
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
use Bref\Context\Context;
use Bref\Event\S3\S3Event;
use Bref\Event\S3\S3Handler;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
class Handler extends S3Handler
{
public LoggerInterface $log;
public function __construct()
{
$this->log = new \Bref\Logger\StderrLogger(LogLevel::INFO);
}
public function handleS3(S3Event $event, Context $context): void
{
$bucketName = $event->getRecords()[0]->getBucket()->getName();
$fileName = $event->getRecords()[0]->getObject()->getKey();
$this->log->info($bucketName);
$this->log->warning($fileName);
}
}
return new Handler();