UNPKG

@huddly/sdk-interfaces

Version:

Module for describing the Huddly SDK using interfaces

43 lines (42 loc) 1.57 kB
import ILogger from './../interfaces/ILogger'; /** * Huddly Logger class. * * Use HUDDLY_LOG_LEVEL env variable to configure the log level on the SDK. The following values apply * - DEBUG - log all gRPC messages * - INFO - log INFO and ERROR message * - ERROR - log only errors (default) * - NONE - won't log any * * Use HUDDLY_LOG_CHANNEL env variable to configure where the logs will be directed to. The following * values apply: * - CONSOLE - Write logs to system console * - FILE - Write logs to a dedicated file provided by HUDDLY_LOG_FILE * * USE HUDDLY_LOG_FILE env variable to specify the file where the logs will be directed to. * * @example * // Print all logs and redirect them to a file * export HUDDLY_LOG_LEVEL=DEBUG && HUDDLY_LOG_CHANNEL=FILE && HUDDLY_LOG_FILE=/users/johndoe/huddlysdk.log * node sdkexample.js * * // Print INFO && ERROR logs and redirect them to console out * export HUDDLY_LOG_LEVEL=INFO * node sdkexample.js * * // Disable all log output * export HUDDLY_LOG_LEVEL=NONE * node sdkexample.js */ export default class Logger { static customLogger: ILogger; static setLogger(logger: ILogger): void; static warn(message: string, component?: string): void; static info(message: string, component?: string): void; static debug(message: string, component?: string): void; static error(message: string, stackTrace: any, component?: string): void; static redirectLogMsg(message: string): void; private static formatDate; private static getTime; private static formatLogMsg; }