Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rxtoolkit/logs
🗒️ RxJS utilities for backend logging
https://github.com/rxtoolkit/logs
fp functional-programming logging observables package reactive-programming rxjs
Last synced: 7 days ago
JSON representation
🗒️ RxJS utilities for backend logging
- Host: GitHub
- URL: https://github.com/rxtoolkit/logs
- Owner: rxtoolkit
- License: mit
- Created: 2021-01-30T14:59:56.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-16T18:40:11.000Z (9 months ago)
- Last Synced: 2024-10-12T17:52:52.902Z (about 1 month ago)
- Topics: fp, functional-programming, logging, observables, package, reactive-programming, rxjs
- Language: JavaScript
- Homepage:
- Size: 289 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @rxtk/logs
## Getting started
```bash
npm i @rxtk/logs
``````bash
yarn add @rxtk/logs
```## API
### logger
```javascript
import logger from '@rxtk/logs';// Log info
const data = {foo: 'bar'};
logger.info('an info message', data);
logger.debug('a debug message', data);// Log an error
const err = new Error('ruh roh');
logger.error(err.message, {stack: err.stack, ...data});
```### toLog
```javascript
import {of} from 'rxjs';
import logger from '@rxtk/logs';const input$ = of(...[{data: 'foo'}, {data:'bar'}]);
input$.pipe(logger.toLog('somelabel'));
input$.subscribe(); // will log the values of each item emitted with the provided label
```### trace
```javascript
import {throwError} from 'rxjs';
import logger from '@rxtk/logs';const err = new Error('zoinks!');
const input$ = throwError(err);
input$.pipe(logger.trace());
input$.subscribe(); // will log any errors emitted including their stack trace
```