Giter Site home page Giter Site logo

winston-postgre's Introduction

winston-postgre

A winston transporter for PostgreSQL database

Installation

npm install winston-postgre

Also, you need to have a table on your postgre database with the following structure:

CREATE TABLE nodelogs
(
  logdate timestamp without time zone,
  level text,
  message text
);

Options

  • connectionString: The PostgreSQL connection string.
  • schema: The schema which the table was created.
  • table: The table name inside the database under the schema.
  • level: The winston log level

See the default values used as example:

var options = {
  "connectionString" : "postgres://username:password@localhost/database",
  "schema" : "public", //default
  "table" : "nodelogs", //default
  "level" : "silly" //default level = info
};

Usage

var winston = require('winston');
require('winston-postgre');

var options = {
  "connectionString" : "postgres://username:password@localhost/database",
  "schema" : "public",
  "table" : "nodelogs",
  "level" : "silly"
};

winston.add(winston.transports.PostgreSQL, options);

winston.log('error', 'Just a simple error log');
winston.log('info', 'Just a simple info log');
winston.log('warn', 'Just a simple warn log');
winston.log('debug', 'Just a simple debug log');
winston.log('verbose', 'Just a simple verbose log');

Feel free to open an issue or do a pull request.

winston-postgre's People

Contributors

eldersantos avatar inurion avatar timjrobinson avatar zone117x avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.