2.0.1 • Published 3 years ago

babel-plugin-winston-source v2.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

babel-plugin-winston-source

Docs are not completed

Winston: Prepends file name and line numbers for each logger command, based on the source files.

Note: you need to use: logger.info(...args) to make it work

.bablerc

{
  "plugins": [
    "babel-plugin-winston-source"
  ]
}

your code

winston log take two args: (message, meta), so zip messages into an array

// src/view/app.js
class App() {
  constructor() {
    logger.log('test', 'foo', 'bar')//line no 20,column no 10
  }
}
↓ ↓ ↓ ↓ ↓ ↓
class App() {
  constructor() {
    logger.log(['test', 'foo', 'bar'], {position: '[s.V/app.js (20:10)]'})
  }
}