MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / consoleHandler

Function consoleHandler

javascript/selenium-webdriver/lib/logging.js:564–597  ·  view source on GitHub ↗

* Logs all messages to the Console API. * @param {!Entry} entry the entry to log.

(entry)

Source from the content-addressed store, hash-verified

562 * @param {!Entry} entry the entry to log.
563 */
564function consoleHandler(entry) {
565 if (typeof console === 'undefined' || !console) {
566 return
567 }
568
569 var timestamp = new Date(entry.timestamp)
570 var msg =
571 '[' +
572 timestamp.getUTCFullYear() +
573 '-' +
574 pad(timestamp.getUTCMonth() + 1) +
575 '-' +
576 pad(timestamp.getUTCDate()) +
577 'T' +
578 pad(timestamp.getUTCHours()) +
579 ':' +
580 pad(timestamp.getUTCMinutes()) +
581 ':' +
582 pad(timestamp.getUTCSeconds()) +
583 'Z] ' +
584 '[' +
585 entry.level.name +
586 '] ' +
587 entry.message
588
589 var level = entry.level.value
590 if (level >= Level.SEVERE.value) {
591 console.error(msg)
592 } else if (level >= Level.WARNING.value) {
593 console.warn(msg)
594 } else {
595 console.log(msg)
596 }
597}
598
599/**
600 * Adds the console handler to the given logger. The console handler will log

Callers

nothing calls this directly

Calls 4

padFunction · 0.85
logMethod · 0.65
errorMethod · 0.45
warnMethod · 0.45

Tested by

no test coverage detected