Log Component
October 10, 2016 ยท View on GitHub
Introduction
Log is a component that allows writing application logs using files, sockets, inboxes, databases and various web services.
Features
Log features:
Examples
This section contains examples and patterns that can be used with described component.
Creating Logger
To create logger use this syntax:
$logger = new Logger($loggerName, $loggers, $processors);
Logging
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
Creating monolog handlers wrapped in Kraken-compatible interface can be done using:
$handler = $loggerFactory->createHandler($handlerNameOrClass, $handlerArgs);
Creating Monolog Processors
Creating monolog processors wrapped in Kraken-compatible interface can be done using:
$processor = $loggerFactory->createProcessor($processorNameOrClass, $processorArgs);
Creating Monolog Formatters
Creating monolog formatters wrapped in Kraken-compatible interface can be done using:
$formatter = $loggerFactory->createFormatter($formatterNameOrClass, $formatterArgs);
Important Classes & Interfaces
This section contains list of most important classes and interfaces shipped with this component. It does not include all classes and interface.
Logger
class Logger implements LoggerInterface
It is an implementation of logger using monolog logger as its model.
LoggerInterface
interface LoggerInterface extends EnumInterface, PsrLoggerInterface
PSR-3 compatible interface for logging.
LoggerFactory
class LoggerFactory
Factory for creating Kraken-compatible instances of Monolog handlers, processors and formatters.