trait WatchdogTrait (View source)

Properties

protected Connection $connection
protected LoggerInterface $logger

Methods

array
where(string|null $type = null, $severity = null, string|null $filter = null, string $criteria = 'AND', int|string|null $severity_min = null)

Build a WHERE snippet based on given parameters.

formatResult(stdClass $result, bool $extended = false)

Format a watchdog database row.

static array
messageTypes()

Helper function to obtain the message types based on drupal version.

Details

protected array where(string|null $type = null, $severity = null, string|null $filter = null, string $criteria = 'AND', int|string|null $severity_min = null)

Build a WHERE snippet based on given parameters.

Example: ('where' => string, 'args' => [])

Parameters

string|null $type

String. Valid watchdog type.

$severity

Int or String for a valid watchdog severity message.

string|null $filter

String. Value to filter watchdog messages by.

string $criteria

('AND', 'OR'). Criteria for the WHERE snippet.

int|string|null $severity_min

Int or String for the minimum severity to return.

Return Value

array

protected stdClass formatResult(stdClass $result, bool $extended = false)

Format a watchdog database row.

Parameters

stdClass $result

A database result object.

bool $extended

Return extended message details.

Return Value

stdClass

The result object with some attributes themed.

static array messageTypes()

Helper function to obtain the message types based on drupal version.

Return Value

array

Array of watchdog message types.