Neuron-PHP

Slack extends DestinationBase
in package

Outputs log data to a Slack channel.

Table of Contents

Properties

$_filters  : array<string|int, mixed>
$_format  : IFormat
$_params  : array<string|int, mixed>
$_parent  : ILogger|null
$_stdErr  : mixed
$_stdOut  : mixed
$_webhook  : string

Methods

__construct()  : mixed
addFilter()  : bool
Adds a logging filter.
close()  : void
Closes the destination if required.
getParent()  : ILogger
Gets the parent logger.
getStdErr()  : mixed
getStdOut()  : mixed
log()  : void
Handles writing the log data after filtering and formatting.
open()  : bool
Setup slack logging.
removeFilter()  : bool
Removes a logging filter.
setFileHandles()  : void
Maps STDERR and STDOUT to file handles in non-CLI environments.
setFormat()  : void
Sets the formatter.
setParent()  : void
Sets the parent logger.
write()  : void
Writes the formatted log data to the specific destination.

Properties

$_params

private array<string|int, mixed> $_params

$_webhook

private string $_webhook

Methods

log()

Handles writing the log data after filtering and formatting.

public log(mixed $text, mixed $level[, mixed $context = [] ]) : void
Parameters
$text : mixed
  • Output that has been run through the formatter.
$level : mixed
  • Text output level.
$context : mixed = []
  • Optional context array

open()

Setup slack logging.

public open(array{endpoint: string, params: array{channel: string, username: string, text: string, icon_emoji?: string, attachments?: array}} $params) : bool
[
   'endpoint' => 'Slack webhook url',
   'params' => [
       'channel' => 'Slack channel',
       'username' => 'Slack user/bot name',
       'text' => 'Slack message',
       'icon_emoji' => 'Slack emoji icon',
       'attachments' => 'Slack attachments'
   ]
]
Parameters
$params : array{endpoint: string, params: array{channel: string, username: string, text: string, icon_emoji?: string, attachments?: array}}
Tags
throws
Exception
Return values
bool

removeFilter()

Removes a logging filter.

public removeFilter(IFilter $removeFilter) : bool
Parameters
$removeFilter : IFilter
Return values
bool

setFileHandles()

Maps STDERR and STDOUT to file handles in non-CLI environments.

public setFileHandles() : void

write()

Writes the formatted log data to the specific destination.

public write(string $text, Data $data) : void
Parameters
$text : string
$data : Data
Tags
SuppressWarnings

(PHPMD)


        
On this page

Search results