Skip to Content
APIUtilsInterface: ILogger

Interface: ILogger

Logger interface (Port) Defines the contract for logging and analytics in the SDK. Following hexagonal architecture, this is a port that can be implemented by different adapters (Countly, console, custom, etc.)

Example

unknown

Methods

logDebug()

void

Logs debug information (only in debug mode)

Parameters

args

unknown[]

Arguments to log

Returns

void


logError()

unknown

Logs an error to error tracking service

Parameters

error

unknown

The error to log

context?

Record<string, string>

Optional context information

Returns

void


logEvent()

Record

Logs an analytics event

Parameters

eventName

string

Name of the event to log

segmentation?

Record<string, string>

Optional key-value pairs for event context

Returns

void


logWarning()

string

Logs a warning (less severe than error)

Parameters

error

unknown

The warning/error to log

context?

Record<string, string>

Optional context information

Returns

void


setDebugMode()?

string

Enables or disables debug mode

Parameters

enabled

boolean

Whether debug logging should be enabled

Returns

void


setToken()?

void

Sets the token for segmentation

Parameters

token

string

API token for identifying the SDK instance

Returns

void

Last updated on