Skip to content

Commit

Permalink
chore: write readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Xstoudi authored Mar 2, 2020
1 parent f0e1b7d commit 4e0f62a
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# pino-pg
A Pino Transport for PostgreSQL databases.

## Installation
```
npm install pino-pg
```

## Usage
Write logs into PostgreSQL
```
node my-app.js | pino-pg -c configuration.json
```

## Configuration file
The configuration file is a JSON file like this :
```json
{
"connection": {
"user": "postgres",
"database": "test-database",
"password": "",
"port": "",
"host": "127.0.0.1"
},
"table": "logs",
"columns": {
"level": "level",
"time": "time",
"pid": "pid",
"hostname": "hostname",
"msg": "msg",
"v": "v"
}
}
```
The `connection` field contains the [node-pg connection information](https://node-postgres.com/features/connecting#Programmatic).
The `table` field is the table where you want to store logs.
The `columns` field allows you to custom PostgreSQL column name for each pino field. Key is pino field, value is column name.

## License
Licensed under [MIT](https://github.com/Xstoudi/pino-pg/blob/master/LICENSE.md)

0 comments on commit 4e0f62a

Please sign in to comment.