MarketData SDK

DefaultLogger extends AbstractLogger
in package

Default PSR-3 compliant logger for MarketDataApp SDK.

Writes log messages to STDERR with format: [timestamp] marketdata.LEVEL: message Supports level filtering - only logs at or above the configured minimum level.

Table of Contents

Constants

LOGGER_NAME  = 'marketdata'
Logger name used in output format.

Properties

$levels  : array<string, int>
$minLevel  : string
$output  : resource|null

Methods

__construct()  : mixed
Create a new DefaultLogger instance.
log()  : void
Log a message at the specified level.
interpolate()  : string
Interpolate context values into message placeholders.

Constants

LOGGER_NAME

Logger name used in output format.

private mixed LOGGER_NAME = 'marketdata'

Properties

$levels

private array<string, int> $levels = [\Psr\Log\LogLevel::DEBUG => 0, \Psr\Log\LogLevel::INFO => 1, \Psr\Log\LogLevel::NOTICE => 2, \Psr\Log\LogLevel::WARNING => 3, \Psr\Log\LogLevel::ERROR => 4, \Psr\Log\LogLevel::CRITICAL => 5, \Psr\Log\LogLevel::ALERT => 6, \Psr\Log\LogLevel::EMERGENCY => 7]

Log level priority mapping (lower = less severe).

$minLevel

private string $minLevel

The minimum log level to output.

$output

private resource|null $output

Output stream (defaults to STDERR).

Methods

__construct()

Create a new DefaultLogger instance.

public __construct([string $minLevel = LogLevel::INFO ][, resource|null $output = null ]) : mixed
Parameters
$minLevel : string = LogLevel::INFO

The minimum log level to output (default: INFO).

$output : resource|null = null

Output stream (default: STDERR). Pass a stream for testing.

log()

Log a message at the specified level.

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

The log level.

$message : string|Stringable

The log message.

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

Context data for interpolation.

interpolate()

Interpolate context values into message placeholders.

private interpolate(string $message, array<string|int, mixed> $context) : string

Replaces {key} placeholders with corresponding values from context array.

Parameters
$message : string

The message with placeholders.

$context : array<string|int, mixed>

The context values.

Return values
string

The interpolated message.


        
On this page

Search results