Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { createLogger, format, transports } = require('winston')
const { json, splat, prettyPrint } = format
const { govUkPayLoggingFormat } = require('@govuk-pay/pay-js-commons').logging
const { addSentryToErrorLevel } = require('./sentry.js')
const logger = createLogger({
format: format.combine(
splat(),
prettyPrint(),
govUkPayLoggingFormat({ container: 'selfservice', environment: process.env.ENVIRONMENT }),
json()
),
transports: [
new transports.Console()
]
})
module.exports = (loggerName) => {
const childLogger = logger.child({ logger_name: loggerName })
return addSentryToErrorLevel(childLogger)
}
const { createLogger, format, transports } = require('winston')
const { json, splat, prettyPrint } = format
const { govUkPayLoggingFormat } = require('@govuk-pay/pay-js-commons').logging
const { addSentryToErrorLevel } = require('./sentry.js')
const logger = createLogger({
format: format.combine(
splat(),
prettyPrint(),
govUkPayLoggingFormat({ container: 'frontend', environment: process.env.ENVIRONMENT }),
json()
),
transports: [
new transports.Console()
]
})
module.exports = (loggerName) => {
const childLogger = logger.child({ logger_name: loggerName })
return addSentryToErrorLevel(childLogger)
}