Server : nginx/1.18.0 System : Linux localhost 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64 User : www-data ( 33) PHP Version : 8.0.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/ecommerce/node_modules/pusher-js/src/core/ |
import { stringify } from './utils/collections';
import Pusher from './pusher';
class Logger {
debug(...args: any[]) {
this.log(this.globalLog, args);
}
warn(...args: any[]) {
this.log(this.globalLogWarn, args);
}
error(...args: any[]) {
this.log(this.globalLogError, args);
}
private globalLog = (message: string) => {
if (global.console && global.console.log) {
global.console.log(message);
}
};
private globalLogWarn(message: string) {
if (global.console && global.console.warn) {
global.console.warn(message);
} else {
this.globalLog(message);
}
}
private globalLogError(message: string) {
if (global.console && global.console.error) {
global.console.error(message);
} else {
this.globalLogWarn(message);
}
}
private log(
defaultLoggingFunction: (message: string) => void,
...args: any[]
) {
var message = stringify.apply(this, arguments);
if (Pusher.log) {
Pusher.log(message);
} else if (Pusher.logToConsole) {
const log = defaultLoggingFunction.bind(this);
log(message);
}
}
}
export default new Logger();