Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stopsopa/inspc
🔬Improved console.log for node.js
https://github.com/stopsopa/inspc
Last synced: 22 days ago
JSON representation
🔬Improved console.log for node.js
- Host: GitHub
- URL: https://github.com/stopsopa/inspc
- Owner: stopsopa
- License: mit
- Created: 2018-12-28T01:37:56.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-01T23:20:02.000Z (about 1 year ago)
- Last Synced: 2024-10-05T00:09:00.248Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm version](https://badge.fury.io/js/inspc.svg)](https://badge.fury.io/js/inspc)
[![NpmLicense](https://img.shields.io/npm/l/inspc.svg)](https://github.com/stopsopa/inspc/blob/master/LICENSE)# DEPRECATED
Created in 2018 - quite old now and not maintainedlogi
---This function use native [util.inspect](https://nodejs.org/api/util.html#util_util_inspect_object_options)
Node.js mode with browser fallback to **logw**
const log = require('inspc/logi');
log.colors(true);
log({data: 'string', fn: () => {}});
log({data: 'string', fn: () => {}}, 2, false); // def: 2, false
log.dump
---In many cases faster implementation
Node.js mode with browser fallback to **logw**
const log = require('inspc/logn');
// const logn = require('inspc/logn').dump;
log.dump({data: 'string', fn: () => {}})
log.dump({data: 'string', fn: () => {}}, 2) // def: 2
logt
---Just fallback to console.log but with timestamp
const logt = require('inspc/logt');
or:
const log = require('inspc');
cosnt logt = log.t;
logw
---Just always safe version of console.log with no timestamp
const logw = require('inspc/logw');
# grabbing output to string variable```javascript
log.start();
log.dump('test1');
log('test2');
// true or false to additionally flush data to screen after return (def false)
const tmp = log.get(true);
```
require all
---
const log = require('inspc');
const data = {
one: 'two',
three: true,
four: () => {},
a: ['str', null, undefined, 2, 'end', {obj:'val'}]
};
data.z = {raz: {dwa: {trzy: {cztery: 'piec'}}}};
log.dump(data, 3)
log.i(data, 3)
log.json(data)
log.i(data, 1, true) // colors on
will print:![image](https://user-images.githubusercontent.com/3743506/50531636-4ca2f200-0b05-11e9-93ae-9641ed80431d.png)
addidional tools
---require('inspc/isObject')
require('inspc/isArray')
const node = require('inspc/isNode');
require('inspc/getUserAgent')
const isGoogleChrome = require('inspc/isGoogleChrome')
const userAgent = (function () {try {return staticContext.req.headers['user-agent']}catch(e){}}());
isGoogleChrome(userAgent)
# extraThere is additional synchronouse method *process._rawDebug* that print directly to terminal