1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 04:37:38 +02:00

return self on several setter/builder methods for more consistent behaviour (#1609)

This commit is contained in:
smiley
2022-03-07 14:24:20 +01:00
committed by GitHub
parent 16cc886c02
commit 168bb6e53d
4 changed files with 22 additions and 8 deletions

View File

@@ -109,11 +109,13 @@ class JsonFormatter extends NormalizerFormatter
}
/**
* @return void
* @return self
*/
public function includeStacktraces(bool $include = true)
public function includeStacktraces(bool $include = true): self
{
$this->includeStacktraces = $include;
return $this;
}
/**

View File

@@ -48,22 +48,28 @@ class LineFormatter extends NormalizerFormatter
parent::__construct($dateFormat);
}
public function includeStacktraces(bool $include = true): void
public function includeStacktraces(bool $include = true): self
{
$this->includeStacktraces = $include;
if ($this->includeStacktraces) {
$this->allowInlineLineBreaks = true;
}
return $this;
}
public function allowInlineLineBreaks(bool $allow = true): void
public function allowInlineLineBreaks(bool $allow = true): self
{
$this->allowInlineLineBreaks = $allow;
return $this;
}
public function ignoreEmptyContextAndExtra(bool $ignore = true): void
public function ignoreEmptyContextAndExtra(bool $ignore = true): self
{
$this->ignoreEmptyContextAndExtra = $ignore;
return $this;
}
/**

View File

@@ -267,13 +267,17 @@ class NormalizerFormatter implements FormatterInterface
return $date->format($this->dateFormat);
}
public function addJsonEncodeOption(int $option): void
public function addJsonEncodeOption(int $option): self
{
$this->jsonEncodeOptions |= $option;
return $this;
}
public function removeJsonEncodeOption(int $option): void
public function removeJsonEncodeOption(int $option): self
{
$this->jsonEncodeOptions &= ~$option;
return $this;
}
}

View File

@@ -272,9 +272,11 @@ class Logger implements LoggerInterface, ResettableInterface
*
* @param bool $micro True to use microtime() to create timestamps
*/
public function useMicrosecondTimestamps(bool $micro): void
public function useMicrosecondTimestamps(bool $micro): self
{
$this->microsecondTimestamps = $micro;
return $this;
}
/**