PHP 클래스 Scalr\LogCollector\Writers\AbstractWriter

저자: Constantine Karnacevych ([email protected])
파일 보기 프로젝트 열기: scalr/scalr 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$host string Either path for local FS or hostname for remote connection
$port integer Port to use if connected to a remote host
$scheme string Protocol to use
$timeout integer How long to wait for reply from the remote end (seconds)

공개 메소드들

메소드 설명
__construct ( string $proto = "http", string $path = "localhost", integer $port = 8888, integer $timeout = 1 ) Constructor. Instantiates the writer.
formatMessage ( array $data ) : string Converts the data into backend acceptable format
send ( array $data ) : boolean Formats and sends the data to a backend using the suitable method depending on protocol

보호된 메소드들

메소드 설명
sendRequest ( string $path = '/', string $body = '', array $queryData = [], array $headers = [], string $method = "POST", array $options = [], array $postFields = [] ) : http\Client\Response Sends HTTP request with specified params.
sleepWait ( ) Sleeps when an attempt to send data failed
writeFile ( string $message ) : boolean Writes data to a local file
writeHttp ( string $message ) : boolean Sends data over HTTP protocol
writeSocket ( string $message ) : boolean Sends data over a socket, using one of TCP, UDP etc. protocols

메소드 상세

__construct() 공개 메소드

Constructor. Instantiates the writer.
public __construct ( string $proto = "http", string $path = "localhost", integer $port = 8888, integer $timeout = 1 )
$proto string optional Protocol to use, e.g. http, tcp, udp. Optional.
$path string optional Either a local FS path or hostname/IP for remote.
$port integer optional Port to use if connected to a remote host.
$timeout integer optional How long to wait for reply from the remote end. (seconds)

formatMessage() 공개 메소드

Converts the data into backend acceptable format
public formatMessage ( array $data ) : string
$data array Prepared array of data to convert into JSON format
리턴 string A JSON formatted string

send() 공개 메소드

Formats and sends the data to a backend using the suitable method depending on protocol
public send ( array $data ) : boolean
$data array Prepared array of data to send
리턴 boolean Indicates whether operation was successful

sendRequest() 보호된 메소드

Sends HTTP request with specified params.
protected sendRequest ( string $path = '/', string $body = '', array $queryData = [], array $headers = [], string $method = "POST", array $options = [], array $postFields = [] ) : http\Client\Response
$path string optional Path URL part
$body string optional Raw request POST content
$queryData array optional Associative array of query-string params
$headers array optional Associative array of request headers
$method string optional Request method
$options array optional Request options
$postFields array optional Associative array of post-fields
리턴 http\Client\Response

sleepWait() 보호된 메소드

Sleeps when an attempt to send data failed
protected sleepWait ( )

writeFile() 보호된 메소드

Writes data to a local file
protected writeFile ( string $message ) : boolean
$message string A prepared message for sending
리턴 boolean Indicates whether operation was successful

writeHttp() 보호된 메소드

Sends data over HTTP protocol
protected writeHttp ( string $message ) : boolean
$message string A prepared message for sending
리턴 boolean Indicates whether operation was successful

writeSocket() 보호된 메소드

Sends data over a socket, using one of TCP, UDP etc. protocols
protected writeSocket ( string $message ) : boolean
$message string A prepared message for sending
리턴 boolean Indicates whether operation was successful

프로퍼티 상세

$host 보호되어 있는 프로퍼티

Either path for local FS or hostname for remote connection
protected string $host
리턴 string

$port 보호되어 있는 프로퍼티

Port to use if connected to a remote host
protected int $port
리턴 integer

$scheme 보호되어 있는 프로퍼티

Protocol to use
protected string $scheme
리턴 string

$timeout 보호되어 있는 프로퍼티

How long to wait for reply from the remote end (seconds)
protected int $timeout
리턴 integer