MCPcopy
hub / github.com/hapijs/hapi / _log

Method _log

lib/core.js:647–667  ·  view source on GitHub ↗
(tags, data, channel = 'internal')

Source from the content-addressed store, hash-verified

645 }
646
647 _log(tags, data, channel = 'internal') {
648
649 if (!this.events.hasListeners('log')) {
650 return;
651 }
652
653 if (!Array.isArray(tags)) {
654 tags = [tags];
655 }
656
657 const timestamp = Date.now();
658 const field = data instanceof Error ? 'error' : 'data';
659
660 let event = { timestamp, tags, [field]: data, channel };
661
662 if (typeof data === 'function') {
663 event = () => ({ timestamp, tags, data: data(), channel });
664 }
665
666 this.events.emit({ name: 'log', tags, channel }, event);
667 }
668};
669
670

Callers 12

handler.jsFile · 0.45
headers.jsFile · 0.45
acceptMethod · 0.45
transmit.jsFile · 0.45
_dispatchMethod · 0.45
_createListenerMethod · 0.45
logMethod · 0.45
failActionMethod · 0.45
_authenticateMethod · 0.45
_accessMethod · 0.45
auth.jsFile · 0.45
_closeMethod · 0.45

Calls 2

emitMethod · 0.80
hasListenersMethod · 0.65

Tested by

no test coverage detected