mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 12:47:39 +02:00
return self on several setter/builder methods for more consistent behaviour (#1609)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user