MarketData SDK

LoggerFactory
in package

Factory for creating and managing logger instances.

Provides singleton access to the configured logger, supporting:

  • Environment variable configuration via MARKETDATA_LOGGING_LEVEL
  • Custom logger injection for framework integration
  • NullLogger for disabled logging (NONE/OFF levels)

Table of Contents

Properties

$instance  : LoggerInterface|null

Methods

getLogger()  : LoggerInterface
Get the configured logger instance.
resetLogger()  : void
Reset the logger singleton.
setLogger()  : void
Set a custom logger instance.

Properties

$instance

private static LoggerInterface|null $instance = null

Singleton logger instance.

Methods

getLogger()

Get the configured logger instance.

public static getLogger() : LoggerInterface

Creates a new logger on first call based on MARKETDATA_LOGGING_LEVEL. Subsequent calls return the same instance.

Return values
LoggerInterface

The configured logger.

resetLogger()

Reset the logger singleton.

public static resetLogger() : void

Clears the cached logger instance, causing the next getLogger() call to create a new logger. Useful for testing.

setLogger()

Set a custom logger instance.

public static setLogger(LoggerInterface $logger) : void

Use this to inject a custom PSR-3 logger (Monolog, Laravel, etc.).

Parameters
$logger : LoggerInterface

The custom logger to use.


        
On this page

Search results