acuminous / tripitaka

Tripitaka is a low dependency, no frills logger for Node.js
ISC License
11 stars 5 forks source link

Import confusion in example #3

Closed faassen closed 3 years ago

faassen commented 3 years ago

Reading the readme, I find the following:

const { Logger, Level, processors, transports, } = require('tripitaka');
const { context, error, timestamp, json } = processors;
const { json, human } = transports;

const logger = new Logger({
  level: Level.INFO,
  processors: [
    context(),
    error(),
    timestamp(),
    process.env.NODE_ENV === 'production' ? json() : human(),
  ],
  transports: [
    stream(),
  ],
})

Here we're importing a json processor and the json transport, which won't work.

In addition I am confused by the usage; we import a human transport but it's used as a processor. And stream isn't being imported.

cressie176 commented 3 years ago

My bad. Both human and json are processors, not transports. Will fix.

cressie176 commented 3 years ago

Fixed.