Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldersantos/winston-postgre
A winston transporter for PostgreSQL database
https://github.com/eldersantos/winston-postgre
database javascript npm-package postgresql-database schema winston-postgre winston-transport
Last synced: 8 days ago
JSON representation
A winston transporter for PostgreSQL database
- Host: GitHub
- URL: https://github.com/eldersantos/winston-postgre
- Owner: eldersantos
- License: gpl-2.0
- Created: 2014-07-31T23:45:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-11T19:59:42.000Z (over 8 years ago)
- Last Synced: 2024-11-02T03:34:01.799Z (16 days ago)
- Topics: database, javascript, npm-package, postgresql-database, schema, winston-postgre, winston-transport
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
winston-postgre
===============A winston transporter for PostgreSQL database
Installation
------------``` bash
npm install winston-postgre
```Also, you need to have a table on your postgre database with the following structure:
``` sql
CREATE TABLE nodelogs
(
logdate timestamp without time zone,
level text,
message text,
meta 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 levelSee the default values used as example:
``` js
var options = {
"connectionString" : "postgres://username:password@localhost/database",
"schema" : "public", //default
"table" : "nodelogs", //default
"level" : "silly" //default level = info
};
```Usage
------------``` js
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.