ConsoleHandler
namespace |
bhenk\logger\handle |
predicates |
Cloneable | Instantiable |
implements |
|
extends |
|
hierarchy |
Handler class for displaying log output on console
Constructor
ConsoleHandler::__construct
predicates |
public | constructor |
Outputs log statements to console
This AbstractHandler is especially equipped to be used during development. See ConsoleLoggerTrait on how to switch logging to console for a particular TestCase.
The $stack_match expects a regular expression. It can be used to suppress the amount of
stacktrace elements of Throwables. Par example, the regex
"/application\/(bhenk|unit)/i" will only print traces of files that have either
/application/bhenk or /application/unit in their filename.
Defaults to "/(.*?)/i" - all files.
The $date_format defaults to a short “H:i:s:u”.
The $color_scheme points to the (fully qualified) classname of a class implementing the ColorSchemeInterface and defaults to ColorSchemeDark, a dark scheme.
See also AbstractHandler.
public function __construct(
Parameter #0 [ <optional> Monolog\Level|string|int $level = \Monolog\Level::Debug ]
Parameter #1 [ <optional> bool $bubble = false ]
Parameter #2 [ <optional> bool $white_line = true ]
Parameter #3 [ <optional> ?string $stack_match = NULL ]
Parameter #4 [ <optional> ?string $date_format = NULL ]
Parameter #5 [ <optional> ?string $exclamation = NULL ]
Parameter #6 [ <optional> ?string $color_scheme = NULL ]
)
Methods
ConsoleHandler::getColorScheme
predicates |
public |
Get the color scheme used by this class
public function getColorScheme(): ColorSchemeInterface
ConsoleHandler::resetCount
predicates |
public |
Reset the log statement counter
public function resetCount(): void
ConsoleHandler::handle
predicates |
public |
implements |
@inheritdoc
Handles a record
All records may be passed to this method, and the handler should discard those that it does not want to handle.
The return value of this function controls the bubbling process of the handler stack. Unless the bubbling is interrupted (by returning true), the Logger class will keep on calling further handlers in the stack with a given log record.
@inheritdoc from method HandlerInterface::handle
public function handle(
Parameter #0 [ <required> Monolog\LogRecord $record ]
): bool
ConsoleHandler::isHandling
predicates |
public |
implements |
|
inherited from |
@inheritdoc
Checks whether the given record will be handled by this handler
This is mostly done for performance reasons, to avoid calling processors for nothing.
Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.
@inheritdoc from method HandlerInterface::isHandling
public function isHandling(
Parameter #0 [ <required> Monolog\LogRecord $record ]
): bool
ConsoleHandler::setLevel
predicates |
public |
inherited from |
Sets minimum logging level at which this handler will be triggered
public function setLevel(
Parameter #0 [ <required> Monolog\Level|string|int $level ]
): self
ConsoleHandler::getLevel
predicates |
public |
inherited from |
Gets minimum logging level at which this handler will be triggered
public function getLevel(): Level
ConsoleHandler::setBubble
predicates |
public |
inherited from |
Sets the bubbling behavior
public function setBubble(
Parameter #0 [ <required> bool $bubble ]
): self
ConsoleHandler::getBubble
predicates |
public |
inherited from |
Gets the bubbling behavior
public function getBubble(): bool
ConsoleHandler::reset
predicates |
public |
implements |
|
inherited from |
@inheritdoc
No DocComment found on method ResettableInterface::reset
public function reset(): void
ConsoleHandler::handleBatch
predicates |
public |
implements |
|
inherited from |
@inheritdoc
Handles a set of records at once
@inheritdoc from method HandlerInterface::handleBatch
public function handleBatch(
Parameter #0 [ <required> array $records ]
): void
ConsoleHandler::close
predicates |
public |
implements |
|
inherited from |
@inheritdoc
Closes the handler
Ends a log cycle and frees all resources used by the handler.
Closing a Handler means flushing all buffers and freeing any open resources/handles.
Implementations have to be idempotent (i.e. it should be possible to call close several times without breakage) and ideally handlers should be able to reopen themselves on handle() after they have been closed.
This is useful at the end of a request and will be called automatically when the object is destroyed if you extend MonologHandlerHandler.
If you are thinking of calling this method yourself, most likely you should be calling ResettableInterface::reset instead. Have a look.
@inheritdoc from method HandlerInterface::close
public function close(): void
ConsoleHandler::__destruct
predicates |
public |
inherited from |
public function __destruct()
ConsoleHandler::__sleep
predicates |
public |
inherited from |
public function __sleep()
Sat, 29 Apr 2023 12:38:18 +0000