Skip to content

Commit

Permalink
feat: log outputs to run.out
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Nov 6, 2020
1 parent 8fe26d0 commit 760c4bf
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions runtime/logger.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const winston = require('winston')
const path = require('path')

function getLogger (params) {
const format = winston.format.combine(
Expand All @@ -11,16 +12,24 @@ function getLogger (params) {
winston.format.json()
)

const transports = [
new winston.transports.Console({ format }),
new winston.transports.File({ filename: 'stdout', format })
]

if (params.testOutputsPath) {
transports.push(new winston.transports.File({
format,
filename: path.join(params.testOutputsPath, 'run.out')
}))
}

return winston.createLogger({
level: process.env.LOG_LEVEL !== ''
? process.env.LOG_LEVEL
: 'info',
format,
transports: [
new winston.transports.Console({
format
})
]
transports
})
}

Expand Down

0 comments on commit 760c4bf

Please sign in to comment.