adonisjs / logger

AdonisJS Logger built on top of pino
https://docs.adonisjs.com/guides/logger
MIT License
23 stars 9 forks source link

sprintf syntax does not work with file transport #45

Closed adeel94mirza closed 3 years ago

adeel94mirza commented 4 years ago

For some reason the sprintf syntax is not working with the file transport. It is fine for console transport

Console info: serving app on http://127.0.0.1:3333 info: User Logged In: you@you.com

File info: serving app on %s%s info: User Logged In: %s

Package version

4.1.0

Node.js and npm version

node 12.12.0 npm 6.13.4

ikenfin commented 3 years ago

@adeel94mirza Same here! But seems adding custom winston format to the config fixed issue:

const winston = require('winston')

module.exports = {
  // ... config
  logger: {
    file: {
      driver: 'file',
      filename: 'app.log',
      level: 'info',
      // fix formats
      format: winston.format.combine(
        winston.format.splat(),
        winston.format.json()
      )
    }
  }
}
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.