Skip to content

Madadata/winston-pg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postgres transport for Winston

CircleCI Dependency Status

Install

npm install --save winston pg winston-pg

Both pg and winsotn are peer dependencies.

Test and example

See index.spec.js for test spec.

Example usage:

const pgLogger = new PgLogger({
  name: 'test-logger',
  level: 'debug',
  connString: 'postgres://ubuntu@localhost:5432/circle_test',
  tableName: 'winston_logs',
});
logger = new winston.Logger({
  transports: [
    new winston.transports.Console({
      color: true,
      timestamp: true,
    }),
    pgLogger,
  ]
});
pgLogger.initTable(done); // or create the table in database by yourself