Skip to content

Commit c03f2b3

Browse files
committed
Add chunk_size option for udp transport
Close #45
1 parent 4c973e2 commit c03f2b3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ return [
9696
// This optional option determines the port on which the gelf
9797
// receiver host is listening. Default is 12201
9898
'port' => 12201,
99+
100+
// This optional option determines the chunk size used when
101+
// transferring message via UDP transport. Default is 1420.
102+
'chunk_size' => 1420,
99103

100104
// This optional option determines the path used for the HTTP
101105
// transport. When forgotten or set to null, default path '/gelf'

src/GelfLoggerFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __invoke(array $config): Logger
3131
$config['transport'],
3232
$config['host'],
3333
$config['port'],
34+
$config['chunk_size'],
3435
$config['path'],
3536
$this->enableSsl($config) ? $this->sslOptions($config['ssl_options']) : null
3637
);
@@ -62,6 +63,7 @@ protected function parseConfig(array $config): array
6263
$config['transport'] ??= 'udp';
6364
$config['host'] ??= '127.0.0.1';
6465
$config['port'] ??= 12201;
66+
$config['chunk_size'] ??= UdpTransport::CHUNK_SIZE_WAN;
6567
$config['path'] ??= null;
6668
$config['system_name'] ??= null;
6769
$config['extra_prefix'] ??= null;
@@ -85,6 +87,7 @@ protected function getTransport(
8587
string $transport,
8688
string $host,
8789
int $port,
90+
int $chunkSize,
8891
?string $path = null,
8992
?SslOptions $sslOptions = null
9093
): AbstractTransport {
@@ -93,7 +96,7 @@ protected function getTransport(
9396
'http' => $path
9497
? new HttpTransport($host, $port, $path, $sslOptions)
9598
: new HttpTransport($host, $port, sslOptions: $sslOptions),
96-
default => new UdpTransport($host, $port),
99+
default => new UdpTransport($host, $port, $chunkSize),
97100
};
98101
}
99102

0 commit comments

Comments
 (0)