function registerOTelDiagLogger()

in packages/opentelemetry-node/lib/logging.js [76:99]


function registerOTelDiagLogger(api) {
    // TODO: when luggite supports .child, add a module/component attr for diag log output
    const diagLevel = otelLogLevelFromEnv();
    api.diag.setLogger(
        {
            error: (msg, ...args) => {
                if (FILTER_OUT_DIAG_ERROR_MESSAGES.includes(msg)) {
                    return;
                }
                log.error(msg, ...args);
            },
            warn: (msg, ...args) => {
                if (FILTER_OUT_DIAG_WARN_MESSAGES.includes(msg)) {
                    return;
                }
                log.warn(msg, ...args);
            },
            info: log.info.bind(log),
            debug: log.debug.bind(log),
            verbose: log.trace.bind(log),
        },
        api.DiagLogLevel[diagLevel]
    );
}