You are here

function monolog_socket_handler_loader in Monolog 6

Same name and namespace in other branches
  1. 7 handlers/socket.inc \monolog_socket_handler_loader()

Monolog loader callback; Loads a StreamHandler handler.

Return value

HandlerInterface

File

handlers/socket.inc, line 15
Handler include for SocketHandler include.

Code

function monolog_socket_handler_loader($options) {
  $handler = new SocketHandler($options['connection_string'], $options['level'], $options['bubble']);
  $handler
    ->setPersistent((bool) $options['persistent']);
  if ($options['connection_timeout']) {
    $handler
      ->setConnectionTimeout($options['connection_timeout']);
  }
  if ($options['write_timeout']) {
    $handler
      ->setTimeout($options['write_timeout']);
  }
  return $handler;
}