- Important Classes & Interfaces
Log is a component that allows writing application logs using files, sockets, inboxes, databases and various web services.
- Support for storing logs in files, databases or cloud storages
- Decorators for monolog formatters
- Decorators for monolog handlers
- Decorators for monolog processors
- PSR-3 compatibility
- Kraken Framework compatibility
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
debug and others.
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.
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.
Factory for creating Kraken-compatible instances of Monolog handlers, processors and formatters.