ErrorLogger
Responsible for logging exceptions
class ErrorLogger implements LoggerAwareInterfaceuse LoggerAwareTrait- Copyright
- 2015-2016 Appertly
- License
- Apache-2.0
Constructors / Destructors
| Returns | Signature and Description |
|---|---|
void | __construct(, )Creates a new ErrorLogger. |
Instance Methods
| Returns | Signature and Description |
|---|---|
void | log()Logs an exception. |
Method Details
__construct
public function
__construct(?LoggerInterface $logger = null, ?ConstMap<string,string> $levels = null)Creates a new ErrorLogger.
If an exception isn't found in the $levels map, this class assumes a
level of LogLevel::ERROR.
$elog = new ErrorLogger(
$logger,
Map {"MyException" => LogLevel::DEBUG, "RuntimeException" => LogLevel::WARN}
);
| Name | Type | Description |
|---|---|---|
$logger | ?LoggerInterface | The logger; will use |
$levels | ?ConstMap<string,string> | Map of Exception names to log levels. Order matters! |
log
public function
log(Exception $e)Logs an exception.
If an exception isn't found in the $levels map, this class assumes a
level of LogLevel::ERROR.
| Name | Type | Description |
|---|---|---|
$e | Exception | The exception to log |