public log()

in src/diagnostic-channel-publishers/src/winston.pub.ts [66:83]


        public log(info: any, callback: any) {
            // tslint:disable-next-line:prefer-const - try to obtain level from Symbol(level) afterwards
            let { message, level, meta, ...splat } = info;
            level = typeof Symbol["for"] === "function" ? info[Symbol["for"]("level")] : level; // Symbol(level) is uncolorized, so prefer getting it from here
            message = info instanceof Error ? info : message; // Winston places Errors at info, strings at info.message

            const levelKind = mapLevelToKind(this.winston, level);

            meta = meta || {}; // Winston _somtimes_ puts metadata inside meta, so start from here
            for (const key in splat) {
                if (splat.hasOwnProperty(key)) {
                    meta[key] = splat[key];
                }
            }

            channel.publish<IWinstonData>("winston", { message, level, levelKind, meta });
            callback();
        }