/** * * Agora Real Time Engagement * Created by Wei Hu in 2022-05. * Copyright (c) 2015 Agora IO. All rights reserved. * */ import rte_addon from '../rte_addon'; export function debug(...args: unknown[]): void { if (process.env.NODE_ENV === 'development') { logInternal(args, console.debug); } } export function info(...args: unknown[]): void { if (process.env.NODE_ENV === 'development') { logInternal(args, console.info); } } export function error(...args: unknown[]): void { logInternal(args, console.error); } export function warn(...args: unknown[]): void { logInternal(args, console.warn); } export function setLogFile(filePath: string): void { rte_addon.rte_nodejs_log_set_log_file(null, filePath ? filePath : ''); } function logInternal( args: unknown[], func: (...args: unknown[]) => void, ): void { if (typeof console !== 'undefined') { func('[RTE_RUNTIME] ', ...args); } }