function mkLogEmitter()

in packages/opentelemetry-node/lib/luggite.js [354:380]


function mkLogEmitter(minLevel) {
    return function LOG(...args) {
        var log = this;
        var rec = null;

        if (!this._emit) {
            // See <https://github.com/trentm/node-bunyan/issues/100> for
            // an example of how this can happen.
            var loc = new Error('');
            loc.name = '';
            _warn(
                'usage error: attempt to log with an unbound log method' +
                    loc.stack,
                'unbound'
            );
            return;
        } else if (args.length === 0) {
            // `log.<level>()`
            return this._level <= minLevel;
        }

        if (this._level <= minLevel) {
            rec = mkRecord(log, minLevel, args);
            this._emit(rec);
        }
    };
}