ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
Monolog\Handler\PsrHandler Class Reference

Proxies log messages to an existing PSR-3 compliant logger. More...

+ Inheritance diagram for Monolog\Handler\PsrHandler:
+ Collaboration diagram for Monolog\Handler\PsrHandler:

Public Member Functions

 __construct (LoggerInterface $logger, $level=Logger::DEBUG, $bubble=true)
 
 handle (array $record)
 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.
Parameters
array$recordThe record to handle
Returns
Boolean true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
More...
 
- Public Member Functions inherited from Monolog\Handler\AbstractHandler
 __construct ($level=Logger::DEBUG, $bubble=true)
 
 isHandling (array $record)
 {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.
Parameters
array$recordPartial log record containing only a level key
Returns
Boolean
} More...
 
 handleBatch (array $records)
 {Handles a set of records at once.
Parameters
array$recordsThe records to handle (an array of record arrays)
} More...
 
 close ()
 Closes the handler. More...
 
 pushProcessor ($callback)
 {Adds a processor in the stack.
Parameters
callable$callback
Returns
self
} More...
 
 popProcessor ()
 {Removes the processor on top of the stack and returns it.
Returns
callable
} More...
 
 setFormatter (FormatterInterface $formatter)
 {Sets the formatter.
Parameters
FormatterInterface$formatter
Returns
self
} More...
 
 getFormatter ()
 {Gets the formatter.
Returns
FormatterInterface
} More...
 
 setLevel ($level)
 Sets minimum logging level at which this handler will be triggered. More...
 
 getLevel ()
 Gets minimum logging level at which this handler will be triggered. More...
 
 setBubble ($bubble)
 Sets the bubbling behavior. More...
 
 getBubble ()
 Gets the bubbling behavior. More...
 
 __destruct ()
 

Protected Attributes

 $logger
 
- Protected Attributes inherited from Monolog\Handler\AbstractHandler
 $level = Logger::DEBUG
 
 $bubble = true
 
 $formatter
 
 $processors = array()
 

Additional Inherited Members

- Protected Member Functions inherited from Monolog\Handler\AbstractHandler
 getDefaultFormatter ()
 Gets the default formatter. More...
 

Detailed Description

Proxies log messages to an existing PSR-3 compliant logger.

Author
Michael Moussa micha.nosp@m.el.m.nosp@m.oussa.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Definition at line 22 of file PsrHandler.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Handler\PsrHandler::__construct ( LoggerInterface  $logger,
  $level = Logger::DEBUG,
  $bubble = true 
)
Parameters
LoggerInterface$loggerThe underlying PSR-3 compliant logger to which messages will be proxied
int$levelThe minimum logging level at which this handler will be triggered
Boolean$bubbleWhether the messages that are handled can bubble up the stack or not

Definition at line 36 of file PsrHandler.php.

References Monolog\Handler\AbstractHandler\$bubble, Monolog\Handler\AbstractHandler\$level, and Monolog\Handler\PsrHandler\$logger.

37  {
38  parent::__construct($level, $bubble);
39 
40  $this->logger = $logger;
41  }

Member Function Documentation

◆ handle()

Monolog\Handler\PsrHandler::handle ( array  $record)

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.

Parameters
array$recordThe record to handle
Returns
Boolean true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.

Implements Monolog\Handler\HandlerInterface.

Definition at line 46 of file PsrHandler.php.

References Monolog\Handler\AbstractHandler\$bubble, and Monolog\Handler\AbstractHandler\isHandling().

47  {
48  if (!$this->isHandling($record)) {
49  return false;
50  }
51 
52  $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']);
53 
54  return false === $this->bubble;
55  }
isHandling(array $record)
{Checks whether the given record will be handled by this handler.This is mostly done for performance ...
+ Here is the call graph for this function:

Field Documentation

◆ $logger

Monolog\Handler\PsrHandler::$logger
protected

Definition at line 29 of file PsrHandler.php.

Referenced by Monolog\Handler\PsrHandler\__construct().


The documentation for this class was generated from the following file: