Genesys Cloud Client Logger
Logger to send client logs to a remote server.
See CHANGELOG.md for version updates.
Install
npm install genesys-cloud-client-logger
Basic Concept
Each Logger instance will have it's own configuration meaning you can have multiple apps using their own individual loggers. One thing to note is the loggers
will share a "log-uploader" for each given url
. For example, if app1
and app2
both POST logs to the same endpoint, they will have their own logger and
config, but will share the same uploader. Meaning only one POST request will happen at a time. This is to help reduce rate limiting by having multiple loggers
all sending POST requests to the same endpoint at the same time.
Usage
import { Logger } from 'genesys-cloud-client-logger';
const logger = new Logger({
url: 'https://yoursite.com/logs',
accessToken: 'your-access-token',
appVersion: '1.2.3',
logTopic: 'your-client-app1'
});
logger.info('Logger initialized');
Available options and their defaults:
interface ILoggerConfig {
accessToken: string;
url: string;
appVersion: string;
logTopic: string;
initializeServerLogging?: boolean;
logLevel?: 'log' | 'debug' | 'info' | 'warn' | 'error';;
uploadDebounceTime?: number;
debugMode?: boolean;
stringify?: boolean;
}