mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-02 21:10:47 -05:00
29 lines
558 B
CoffeeScript
29 lines
558 B
CoffeeScript
chalk = require("chalk")
|
|
logger = require("../logger")
|
|
|
|
module.exports = {
|
|
get: ->
|
|
logger.getLogs()
|
|
|
|
clear: ->
|
|
logger.clearLogs()
|
|
|
|
off: ->
|
|
logger.off()
|
|
|
|
onLog: (fn) ->
|
|
logger.onLog(fn)
|
|
|
|
error: (err) ->
|
|
## swallow any errors creating this exception
|
|
logger.createException(err).catch(->)
|
|
|
|
print: ->
|
|
## print all the logs and exit
|
|
@get().then (logs) ->
|
|
logs.forEach (log, i) ->
|
|
str = JSON.stringify(log)
|
|
color = if i % 2 is 0 then "cyan" else "yellow"
|
|
console.log chalk[color](str)
|
|
}
|