import {toLogConfig} from './logging.js';
import {ServerDelegate} from './server.js';
import {toServerConfig} from './config.js';
import {
    Gateway,
    GatewayConfig,
    LogInfo,
    LogLevel
} from '../../../types/gateway-ent';
import {IOGateway} from '@interopio/gateway';

export function create(config: GatewayConfig): Gateway {
    return new ServerDelegate(toServerConfig(config));
}

export function configure_logging(config?: { level: LogLevel, appender?: (info: LogInfo) => void }) {
    IOGateway.Logging.configure(toLogConfig(config));
}
