Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a-x-/thenlog
js promise .then() calls logger for node and browser
https://github.com/a-x-/thenlog
logger promise
Last synced: about 1 month ago
JSON representation
js promise .then() calls logger for node and browser
- Host: GitHub
- URL: https://github.com/a-x-/thenlog
- Owner: a-x-
- License: mit
- Created: 2017-02-09T16:29:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-09T17:15:10.000Z (about 8 years ago)
- Last Synced: 2024-11-12T05:34:55.539Z (3 months ago)
- Topics: logger, promise
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/thenlog
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# .then log
The js-promise-`.then()`-calls logger for both node.js and browser.```js
require('thenlog');Promise.resolve(0)
.thenlog(v=>v + 1)
.thenlog(v=>v * 2)
.thenlog(v=>Math.pow(v, 4))
.then(v => v)
.thenlog(v=>v / 0)
.thenlog(v => {})
.then(v => 'foobar');
```Browser / Node.js
![]()
![]()
## Story en
Promise chains debugging is not too convenient.
You have to replace code shorthands (e.g. `.then(_.union)`) by long statements with a `console.log` instructions.You have to see many 3th-party call-chains in the browser inspector's debugger in async mode.
And `debugger` injection in node.js for async code debugging using `node debug` is not convenient way again.## Story ru
Дебажить промисы не очень удобно.
То и дело приходится разорять изящные конструкции вида `.then(_.union)`, внедряя туда `console.log`.В дебаггере браузера часто приходится смотреть на полотна 3th-party кода.
А в node.js с помощью `node debug` чтобы отлаживать асинхронщину приходится внедрять тут и там `debugger`, что очень неудобно, см. выше.