mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 20:57:36 +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;
|
$this->includeStacktraces = $include;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -48,22 +48,28 @@ class LineFormatter extends NormalizerFormatter
|
|||||||
parent::__construct($dateFormat);
|
parent::__construct($dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeStacktraces(bool $include = true): void
|
public function includeStacktraces(bool $include = true): self
|
||||||
{
|
{
|
||||||
$this->includeStacktraces = $include;
|
$this->includeStacktraces = $include;
|
||||||
if ($this->includeStacktraces) {
|
if ($this->includeStacktraces) {
|
||||||
$this->allowInlineLineBreaks = true;
|
$this->allowInlineLineBreaks = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function allowInlineLineBreaks(bool $allow = true): void
|
public function allowInlineLineBreaks(bool $allow = true): self
|
||||||
{
|
{
|
||||||
$this->allowInlineLineBreaks = $allow;
|
$this->allowInlineLineBreaks = $allow;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ignoreEmptyContextAndExtra(bool $ignore = true): void
|
public function ignoreEmptyContextAndExtra(bool $ignore = true): self
|
||||||
{
|
{
|
||||||
$this->ignoreEmptyContextAndExtra = $ignore;
|
$this->ignoreEmptyContextAndExtra = $ignore;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -267,13 +267,17 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
return $date->format($this->dateFormat);
|
return $date->format($this->dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addJsonEncodeOption(int $option): void
|
public function addJsonEncodeOption(int $option): self
|
||||||
{
|
{
|
||||||
$this->jsonEncodeOptions |= $option;
|
$this->jsonEncodeOptions |= $option;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeJsonEncodeOption(int $option): void
|
public function removeJsonEncodeOption(int $option): self
|
||||||
{
|
{
|
||||||
$this->jsonEncodeOptions &= ~$option;
|
$this->jsonEncodeOptions &= ~$option;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -272,9 +272,11 @@ class Logger implements LoggerInterface, ResettableInterface
|
|||||||
*
|
*
|
||||||
* @param bool $micro True to use microtime() to create timestamps
|
* @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;
|
$this->microsecondTimestamps = $micro;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user