/*
 * Copyright (c) 2023-2025 Datalayer, Inc.
 * Distributed under the terms of the Modified BSD License.
 */
class Logger {
    scope;
    isDevelopment;
    constructor(scope) {
        this.scope = scope;
        this.isDevelopment = process.env.NODE_ENV === 'development';
    }
    log(level, message, ...args) {
        if (!this.isDevelopment && level === 'debug') {
            return;
        }
        const timestamp = new Date().toISOString();
        const prefix = `[${timestamp}] [${this.scope}] [${level.toUpperCase()}]`;
        switch (level) {
            case 'debug':
                console.debug(prefix, message, ...args);
                break;
            case 'info':
                console.info(prefix, message, ...args);
                break;
            case 'warn':
                console.warn(prefix, message, ...args);
                break;
            case 'error':
                console.error(prefix, message, ...args);
                break;
        }
    }
    debug(message, ...args) {
        this.log('debug', message, ...args);
    }
    info(message, ...args) {
        this.log('info', message, ...args);
    }
    warn(message, ...args) {
        this.log('warn', message, ...args);
    }
    error(message, ...args) {
        this.log('error', message, ...args);
    }
}
export function createLogger(scope) {
    return new Logger(scope);
}
export const coreLogger = createLogger('core');
export const apiLogger = createLogger('api');
export const stateLogger = createLogger('state');
export const configLogger = createLogger('config');
