function formatArgument(value) {
    if (typeof value === 'string')
        return value;
    if (value instanceof Error)
        return value.message;
    try {
        return JSON.stringify(value);
    }
    catch {
        return String(value);
    }
}
function recordTo(target) {
    return (...args) => {
        target.push(args.map(formatArgument).join(' '));
    };
}
export function createCapturingLogger() {
    const infoMessages = [];
    const warnMessages = [];
    const errorMessages = [];
    const logger = {
        info: recordTo(infoMessages),
        warn: recordTo(warnMessages),
        error: recordTo(errorMessages),
        debug: () => { },
        trace: () => { },
        fatal: recordTo(errorMessages),
        child() {
            return logger;
        },
        level: 'silent',
    };
    return { logger, infoMessages, warnMessages, errorMessages };
}
//# sourceMappingURL=capturingLogger.stub.js.map