Log is a component that allows writing application logs using files, sockets, inboxes, databases and various web services.
Log features:
This section contains examples and patterns that can be used with described component.
To create logger use this syntax:
$logger = new Logger($loggerName, $loggers, $processors);
Logging uses the same interface as PSR-3 or Monolog, so you can use methods such as emergency
, alert
, critical
, error
, warning
, notice
, info
, debug
and others.
The log
method is also supported:
$logger->log($logger::WARNING, 'Something went wrong!', $context);
Creating monolog handlers wrapped in Kraken-compatible interface can be done using:
$handler = $loggerFactory->createHandler($handlerNameOrClass, $handlerArgs);
Creating monolog processors wrapped in Kraken-compatible interface can be done using:
$processor = $loggerFactory->createProcessor($processorNameOrClass, $processorArgs);
Creating monolog formatters wrapped in Kraken-compatible interface can be done using:
$formatter = $loggerFactory->createFormatter($formatterNameOrClass, $formatterArgs);
This section contains list of most important classes and interfaces shipped with this component. It does not include all classes and interface.
class Logger implements LoggerInterface
It is an implementation of logger using monolog logger as its model.
interface LoggerInterface extends EnumInterface, PsrLoggerInterface
PSR-3 compatible interface for logging.
class LoggerFactory
Factory for creating Kraken-compatible instances of Monolog handlers, processors and formatters.