Comparing version 0.1.0 to 0.1.1
@@ -0,1 +1,8 @@ | ||
## [0.1.1](https://github.com/ayZagen/pino-kafka/compare/v0.1.0...v0.1.1) (2021-04-10) | ||
### Features | ||
* expose kafka stream ([a1a0e2f](https://github.com/ayZagen/pino-kafka/commit/a1a0e2faf70ab8a2906307c4472b20c2a74afc14)) | ||
# 0.1.0 (2021-01-18) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "pino-kafka", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A pino 'transport' for writing to kafka", | ||
"homepage": "https://github.com/pinojs/pino-kafka", | ||
"bugs": "https://github.com/pinojs/pino-kafka/issues", | ||
"homepage": "https://github.com/ayZagen/pino-kafka", | ||
"bugs": "https://github.com/ayZagen/pino-kafka/issues", | ||
"main": "pkafka.js", | ||
@@ -32,9 +32,9 @@ "scripts": { | ||
"devDependencies": { | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@release-it/conventional-changelog": "^2.0.0", | ||
"husky": "^4.3.8", | ||
"mocha": "^8.2.1", | ||
"pino": "^6.11.0", | ||
"release-it": "^14.2.2" | ||
"@commitlint/cli": "^12.1.1", | ||
"@commitlint/config-conventional": "^12.1.1", | ||
"@release-it/conventional-changelog": "^2.0.1", | ||
"husky": "^6.0.0", | ||
"mocha": "^8.3.2", | ||
"pino": "^6.11.2", | ||
"release-it": "^14.6.0" | ||
}, | ||
@@ -44,7 +44,2 @@ "engines": { | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"release-it": { | ||
@@ -51,0 +46,0 @@ "plugins": { |
@@ -75,4 +75,6 @@ const stream = require('stream') | ||
through._kafka = kafkaStream | ||
return through; | ||
} | ||
@@ -12,3 +12,3 @@ <p align="center"> | ||
```bash | ||
```shell | ||
$ npm install --production -g pino-kafka | ||
@@ -28,6 +28,6 @@ ### or with yarn | ||
### CLI | ||
Given an application `foo` that logs via [pino][pino], and a kafka broker listening on `10.10.10.5` you would use `pino-kafka` as: | ||
Given an application `foo` that logs via [pino][pino], and a kafka broker listening on `10.10.10.5:9200` you would use `pino-kafka` as: | ||
```bash | ||
$ node foo | pino-kafka -b 10.10.10.5 | ||
$ node foo | pino-kafka -b 10.10.10.5:9200 | ||
``` | ||
@@ -41,3 +41,3 @@ | ||
const logger = pino({}, pkafka({ brokers: "10.10.10.5"})) | ||
const logger = pino({}, pkafka({ brokers: "10.10.10.5:9200"})) | ||
``` | ||
@@ -87,6 +87,6 @@ ## Options | ||
```bash | ||
$ yes | pino-kafka -s ./settings.json -b 10.10.10.11 | ||
$ yes | pino-kafka -s ./settings.json -b 10.10.10.11:9200 | ||
``` | ||
The connection will be made to address `10.10.10.11` with the default topic port `test`. | ||
The connection will be made to address `10.10.10.11:9200` with the default topic `test`. | ||
@@ -124,3 +124,37 @@ ### Kafka Settings | ||
### Accessing Internal Kafka Producer | ||
You can access `node-rdkafka` producer from pino stream with `_kafka`. | ||
For example: | ||
```js | ||
const pino = require('pino') | ||
const logger = pino({}, pkafka({ brokers: "10.10.10.5:9200"})) | ||
logger[pino.symbols.streamSym]._kafka.getMetadata({}, (err, data)=> { | ||
//... | ||
}) | ||
``` | ||
## Testing | ||
For running tests make sure you installed dependencies with `npm install` or `yarn` and have a running kafka. | ||
More easily, if you have docker and docker-compose installed, you can create one with following. | ||
```bash | ||
$ cd pino-kafka | ||
$ docker-compose up -d | ||
``` | ||
Look at [docker-compose file](docker-compose.yml) for more details. | ||
After you all setup, just run test command with following: | ||
```bash | ||
$ npm run test | ||
# or with yarn | ||
$ yarn test | ||
``` | ||
> **NOTE**: If you use your own kafka setup, you may need to change test configuration accordingly to your needs(ip, topic etc.) | ||
## License | ||
[MIT](LICENSE) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
45714
141
1
156