PHP Class GELFMessagePublisher, gelf-php

ファイルを表示 Open project: graylog2/gelf-php Class Usage Examples

Protected Properties

Property Type Description
$chunkSize integer
$hostname string
$port integer
$streamSocketClient resource

Public Methods

Method Description
__construct ( string $hostname, integer $port = self::GRAYLOG2_DEFAULT_PORT, integer $chunkSize = self::CHUNK_SIZE_WAN ) Creates a new publisher that sends errors to a Graylog2 server via UDP
publish ( GELFMessage $message ) : boolean Publishes a GELFMessage, returns false if an error occured during write

Protected Methods

Method Description
getMessageChunks ( string $preparedMessage ) : array
getMessageId ( ) : float
getPreparedMessage ( GELFMessage $message ) : string
getSocketConnection ( ) : resource
isMessageSizeGreaterChunkSize ( string $preparedMessage ) : boolean
prependChunkInformation ( float $messageId, string $data, integer $sequence, integer $sequenceSize ) : string
writeMessageChunkToSocket ( resource $socket, float $messageId, string $messageChunk, integer $messageChunkIndex, integer $messageChunksCount ) : integer | boolean
writeMessageToSocket ( resource $socket, string $preparedMessage ) : integer | boolean

Method Details

__construct() public method

Creates a new publisher that sends errors to a Graylog2 server via UDP
public __construct ( string $hostname, integer $port = self::GRAYLOG2_DEFAULT_PORT, integer $chunkSize = self::CHUNK_SIZE_WAN )
$hostname string
$port integer
$chunkSize integer

getMessageChunks() protected method

protected getMessageChunks ( string $preparedMessage ) : array
$preparedMessage string
return array

getMessageId() protected method

protected getMessageId ( ) : float
return float

getPreparedMessage() protected method

protected getPreparedMessage ( GELFMessage $message ) : string
$message GELFMessage
return string

getSocketConnection() protected method

protected getSocketConnection ( ) : resource
return resource

isMessageSizeGreaterChunkSize() protected method

protected isMessageSizeGreaterChunkSize ( string $preparedMessage ) : boolean
$preparedMessage string
return boolean

prependChunkInformation() protected method

protected prependChunkInformation ( float $messageId, string $data, integer $sequence, integer $sequenceSize ) : string
$messageId float
$data string
$sequence integer
$sequenceSize integer
return string

publish() public method

Publishes a GELFMessage, returns false if an error occured during write
public publish ( GELFMessage $message ) : boolean
$message GELFMessage
return boolean

writeMessageChunkToSocket() protected method

protected writeMessageChunkToSocket ( resource $socket, float $messageId, string $messageChunk, integer $messageChunkIndex, integer $messageChunksCount ) : integer | boolean
$socket resource
$messageId float
$messageChunk string
$messageChunkIndex integer
$messageChunksCount integer
return integer | boolean

writeMessageToSocket() protected method

protected writeMessageToSocket ( resource $socket, string $preparedMessage ) : integer | boolean
$socket resource
$preparedMessage string
return integer | boolean

Property Details

$chunkSize protected_oe property

protected int $chunkSize
return integer

$hostname protected_oe property

protected string $hostname
return string

$port protected_oe property

protected int $port
return integer

$streamSocketClient protected_oe property

protected resource $streamSocketClient
return resource