VuFind API Documentation

Slack extends Post
in package

This class extends the Laminas Logging to send errors to Slack

Tags
category

VuFind

author

Chris Hallberg challber@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Site

Table of Contents

$channel  : string
The slack channel that should receive messages.
$client  : Client
Pre-configured http client
$contentType  : string
Content type
$messageIcons  : array<string|int, mixed>
Icons that appear at the start of log messages in Slack, by severity
$url  : int
Holds the verbosity level
$username  : string
The slack username messages are posted under.
$verbosity  : int
Holds the verbosity level
__construct()  : mixed
Constructor
setContentType()  : void
Set verbosity
setVerbosity()  : void
Set verbosity
applyVerbosity()  : array<string|int, mixed>
Apply verbosity setting to message.
doWrite()  : void
Write a message to the log.
getBody()  : string
Get data for raw body

Properties

$channel

The slack channel that should receive messages.

protected string $channel = '#vufind_log'

$client

Pre-configured http client

protected Client $client = null

$contentType

Content type

protected string $contentType = 'application/x-www-form-urlencoded'

$messageIcons

Icons that appear at the start of log messages in Slack, by severity

protected array<string|int, mixed> $messageIcons = [ ':fire: :fire: :fire: ', // EMERG ':rotating_light: ', // ALERT ':red_circle: ', // CRIT ':exclamation: ', // ERR ':warning: ', // WARN ':speech_balloon: ', // NOTICE ':information_source: ', // INFO ':beetle: ', ]

$url

Holds the verbosity level

protected int $url = null

$username

The slack username messages are posted under.

protected string $username = 'VuFind Log'

$verbosity

Holds the verbosity level

protected int $verbosity = 1

Methods

__construct()

Constructor

public __construct(string $url, Client $client[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$url : string

URL to open as a stream

$client : Client

Pre-configured http client

$options : array<string|int, mixed> = []

Optional settings (may contain 'channel' for the Slack channel to use and/or 'name' for the username messages are posted under)

Return values
mixed

setContentType()

Set verbosity

public setContentType(int $type) : void
Parameters
$type : int

content type string

Return values
void

setVerbosity()

Set verbosity

public setVerbosity(int $verb) : void
Parameters
$verb : int

verbosity setting

Return values
void

applyVerbosity()

Apply verbosity setting to message.

protected applyVerbosity(array<string|int, mixed> $event) : array<string|int, mixed>
Parameters
$event : array<string|int, mixed>

event data

Return values
array<string|int, mixed>

doWrite()

Write a message to the log.

protected doWrite(array<string|int, mixed> $event) : void
Parameters
$event : array<string|int, mixed>

event data

Tags
throws
RuntimeException
Return values
void

getBody()

Get data for raw body

protected getBody(array<string|int, mixed> $event) : string
Parameters
$event : array<string|int, mixed>

event data

Return values
string

Search results