From 7e6fcfa1863be6b602d789f00af4f58563e4a0dc Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Thu, 7 Jul 2022 17:20:13 +0300 Subject: [PATCH] docs: formatting --- README.md | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 16309d0..5014b12 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ -# event-transmitter -Async adapter to save & deliver reasonable events to some endpoint +# @qiwi/event-transmitter +> Async adapter to save & deliver reasonable events to some endpoint + +[![CI](https://github.com/qiwi/event-transmitter/workflows/CI/badge.svg)](https://github.com/qiwi/event-transmitter/actions) +[![Maintainability](https://api.codeclimate.com/v1/badges/d72d92ed2e931dacecf9/maintainability)](https://codeclimate.com/github/qiwi/event-transmitter/maintainability) +[![Test Coverage](https://api.codeclimate.com/v1/badges/d72d92ed2e931dacecf9/test_coverage)](https://codeclimate.com/github/qiwi/event-transmitter/test_coverage) ## Install ```bash @@ -7,21 +11,7 @@ yarn add @qiwi/event-transmitter ``` ## Usage -```typescript -import { createFrontLogProxyTransmitter } from '@qiwi/event-transmitter' -const transmitter = createFrontLogProxyTransmitter({ - appName: 'my-app', - url: 'https://example.qiwi.com/event' -}) - -transmitter.error(new Error('some error')) -transmitter.info('some-event') -transmitter.debug('debug') -transmitter.warn('warn') -transmitter.trace('trace') -``` - -```typescript +```ts import {createTransmitter, createHttpPipe, IPipe} from '@qiwi/event-transmitter' const httpPipe: IPipe = createFetchPusher({ @@ -35,3 +25,24 @@ const event: IClientEventDto = {...} transmitter.push(event) ``` + +### FLP integration +```ts +import { createFrontLogProxyTransmitter } from '@qiwi/event-transmitter' + +const transmitter = createFrontLogProxyTransmitter({ + appName: 'my-app', + url: 'https://example.qiwi.com/event' +}) + +// logger-like interface +transmitter.error(new Error('some error')) +transmitter.info('some-event') +transmitter.debug('debug') +transmitter.warn('warn') +transmitter.trace('trace') +``` +See also [https://github.com/qiwi/flp-njs](https://github.com/qiwi/flp-njs) + +## License +[MIT](LICENSE)