Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/LineParser/ApacheAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ final class ApacheAccess implements LineParser
{
private const FORMAT = '~^(?P<client>\S+) - (?P<user>\S+) \[(?P<time>\d{2}/[a-zA-Z]{3}/\d{4}:\d{2}:\d{2}:\d{2} [+\-]\d{4})] "(?P<method>[A-Z]{3,}) (?P<path>.+) HTTP/(?P<protocol>\d\.\d)" (?P<code>\d+) (?P<size>\d+)$~';

private Clock $clock;

private function __construct(Clock $clock)
private function __construct(private Clock $clock)
{
$this->clock = $clock;
}

#[\Override]
Expand Down
11 changes: 4 additions & 7 deletions src/LineParser/Monolog.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ final class Monolog implements LineParser
private const FORMAT = '~^\[(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\] (?P<channel>[a-zA-Z-_]+)\.(?P<level>EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG): (?P<message>.+) (?P<context>[\{\[].*[\]\}]) (?P<extra>[\{\[].*[\]\}])$~';
private const FORMAT_WITHOUT_EXTRA = '~^\[(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\] (?P<channel>[a-zA-Z-_]+)\.(?P<level>EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG): (?P<message>.+) (?P<context>[\{\[].*[\]\}])$~';

private Clock $clock;
private string $format;

private function __construct(Clock $clock, ?string $format = null)
{
$this->clock = $clock;
$this->format = $format ?? self::FORMAT;
private function __construct(
private Clock $clock,
private string $format,
) {
}

#[\Override]
Expand Down
15 changes: 5 additions & 10 deletions src/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@
*/
final class Log
{
private Point $time;
private Str $raw;
/** @var Set<Attribute> */
private Set $attributes;

/**
* @param Set<Attribute> $attributes
*/
private function __construct(Point $time, Str $raw, Set $attributes)
{
$this->time = $time;
$this->raw = $raw;
$this->attributes = $attributes;
private function __construct(
private Point $time,
private Str $raw,
private Set $attributes,
) {
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Log/Attribute/Monolog/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
*/
final class Channel implements Attribute
{
private string $value;

private function __construct(string $value)
private function __construct(private string $value)
{
$this->value = $value;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Log/Attribute/Monolog/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
*/
final class Level implements Attribute
{
private string $value;

private function __construct(string $value)
private function __construct(private string $value)
{
$this->value = $value;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Log/Attribute/Monolog/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
*/
final class Message implements Attribute
{
private string $value;

private function __construct(string $value)
private function __construct(private string $value)
{
$this->value = $value;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
*/
final class Reader
{
private LineParser $parse;

private function __construct(LineParser $parser)
private function __construct(private LineParser $parse)
{
$this->parse = $parser;
}

#[\NoDiscard]
Expand Down