WebVIEP Plugin

Debug

FinalYes

Lightweight conditional logger aligned with WP_DEBUG or plugin option.

Usage: Debug::info('message', ['key' => 'value']); Debug::error('message', ['exception' => $e]);

Logging is enabled when WEBVIEP_DEBUG, option webviep_debug_enabled, or WP_DEBUG is truthy. Writes to PHP error log as JSON.

Table of Contents

Constants

OPTION_KEY  = 'webviep_debug_enabled'

Methods

error()  : void
Log errors (failures).
info()  : void
Log informational events (non-critical).
warning()  : void
Log warnings (recoverable issues).
isEnabled()  : bool
Determine whether logging is enabled.
log()  : void
Internal log writer.
normalizeContext()  : array<string|int, mixed>
Normalize context values for safe logging.

Constants

OPTION_KEY

private mixed OPTION_KEY = 'webviep_debug_enabled'

Methods

error()

Log errors (failures).

public static error(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string

Message text.

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

Scalar or json-serializable context.

info()

Log informational events (non-critical).

public static info(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string

Message text.

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

Scalar or json-serializable context.

warning()

Log warnings (recoverable issues).

public static warning(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string

Message text.

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

Scalar or json-serializable context.

isEnabled()

Determine whether logging is enabled.

private static isEnabled() : bool
Return values
bool

log()

Internal log writer.

private static log(string $level, string $message, array<string|int, mixed> $context) : void
Parameters
$level : string

INFO|WARN|ERROR.

$message : string

Log message.

$context : array<string|int, mixed>

Context values.

normalizeContext()

Normalize context values for safe logging.

private static normalizeContext(array<string|int, mixed> $context) : array<string|int, mixed>
Parameters
$context : array<string|int, mixed>

Context data.

Return values
array<string|int, mixed>

        
On this page

Search results