You are here

gelf.inc in Monolog 6

Same filename and directory in other branches
  1. 7 handlers/gelf.inc

Handler include for FirePHPHandler.

File

handlers/gelf.inc
View source
<?php

/**
 * @file
 * Handler include for FirePHPHandler.
 */
use Monolog\Handler\GelfHandler;
use Gelf\MessagePublisher;

/**
 * Monolog loader callback; Loads a GelfHandler handler.
 *
 * @return HandlerInterface
 */
function monolog_gelf_handler_loader($options) {
  $publisher = new MessagePublisher($options['hostname'], $options['port'], $options['chunk_size']);
  return new GelfHandler($publisher, $options['level'], $options['bubble']);
}

/**
 * Monolog settings form; Settings for the GelfHandler handler.
 */
function monolog_gelf_handler_settings(&$form, &$form_state, $profile, array $handler) {
  $form['hostname'] = array(
    '#title' => t('Hostname'),
    '#type' => 'textfield',
    '#default_value' => $handler['hostname'],
    '#description' => t('The hostname of the Graylog2 server.'),
    '#required' => TRUE,
  );
  $form['port'] = array(
    '#title' => t('Port'),
    '#type' => 'textfield',
    '#default_value' => $handler['port'],
    '#description' => t('The port that the server is listening on.'),
    '#required' => TRUE,
    '#size' => 6,
  );
  $form['chunk_size'] = array(
    '#title' => t('Chunk size'),
    '#type' => 'textfield',
    '#default_value' => $handler['chunk_size'],
    '#description' => t('The size of chunked messages in bytes. This allows larger messages to be broken up into smaller pieces.'),
    '#required' => TRUE,
    '#size' => 6,
  );
}

Functions

Namesort descending Description
monolog_gelf_handler_loader Monolog loader callback; Loads a GelfHandler handler.
monolog_gelf_handler_settings Monolog settings form; Settings for the GelfHandler handler.