Skip to Content
APIUtilsClass: CountlyLogger

Class: CountlyLogger

Countly Logger Adapter

Implements ILogger interface by wrapping the existing Logger singleton. This adapter bridges the new hexagonal architecture with the existing Countly/Rollbar logging implementation.

Example

const logger: ILogger = new CountlyLogger() logger.logEvent("user_action", { action: "click" }) logger.logError(new Error("Something failed"))

Implements

Constructors

Constructor

new CountlyLogger(): CountlyLogger;

Returns

CountlyLogger

Methods

logDebug()

logDebug(...args): void;

Logs debug information (only in debug mode)

Parameters

args

unknown[]

Returns

void

Implementation of

ILogger.logDebug


logError()

logError(error, context?): void;

Logs an error to Rollbar

Parameters

error

unknown

context?

Record<string, string>

Returns

void

Implementation of

ILogger.logError


logEvent()

logEvent(eventName, segmentation?): void;

Logs an analytics event to Countly

Parameters

eventName

string

segmentation?

Record<string, string>

Returns

void

Implementation of

ILogger.logEvent


logWarning()

logWarning(error, context?): void;

Logs a warning

Parameters

error

unknown

context?

Record<string, string>

Returns

void

Implementation of

ILogger.logWarning


setToken()

setToken(token): void;

Sets the API token for enriching event segmentation

Parameters

token

string

Returns

void

Implementation of

ILogger.setToken

Last updated on