appscot / debug-logger Goto Github PK
View Code? Open in Web Editor NEWA wrapper for visionmedia's debug logger
A wrapper for visionmedia's debug logger
Hey there, awesome little library you've got here.
I was wondering if you know of a way to easily enable logging from within a given file. For example,
var log = require('debug-logger')('RowView');
log.enable()
If it doesn't exist, would it be difficult to add this as a convenience?
Thanks!
Strings with a %
don't display correctly
d.log('11%ab%cdefg');
only outputs:
defg
I.e. everything before the last %
and the immediate next character don't display.
I thought you'd use console, like visionmedia's debug. You did not document that you modify his logging features as such.
Now I get output that is always serialized, and I would like to just expand objects when logging to the browser console...
I'm using this package together with make-error-cause
, which extends errors with a cause
property and overrides the custom inspect function to generate a long stack trace including the cause:
https://github.com/blakeembrey/make-error-cause/blob/master/src/index.ts
This module however does not use util.inspect()
to generate stack traces, instead it accesses .stack
directly so the "extended" stack trace is not printed.
I would appreciate if this could get fixed.
Simple repro case:
process.env.DEBUG = '*';
const { BaseError } = require('make-error-cause');
const log = require('debug-logger')('test');
let cause = new Error('cause');
let e = new BaseError('error', cause);
log.error(e);
Output:
test:error BaseError: error
test:error ___Stack trace #1___
test:error BaseError: error
test:error at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:7:9)
test:error at Module._compile (internal/modules/cjs/loader.js:776:30)
test:error at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
test:error at Module.load (internal/modules/cjs/loader.js:643:32)
test:error at Function.Module._load (internal/modules/cjs/loader.js:556:12)
test:error at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
test:error at internal/main/run_main_module.js:17:11 +0ms
Expected output:
test:error BaseError: error
test:error ___Stack trace #1___
test:error BaseError: error
test:error at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:7:9)
test:error at Module._compile (internal/modules/cjs/loader.js:776:30)
test:error at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
test:error at Module.load (internal/modules/cjs/loader.js:643:32)
test:error at Function.Module._load (internal/modules/cjs/loader.js:556:12)
test:error at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
test:error at internal/main/run_main_module.js:17:11
test:error
test:error The following exception was the direct cause of the above exception:
test:error
test:error Error: cause
test:error at Object.<anonymous> (C:\Users\Ruben Anders\Nextcloud\Projects\dank-twitch-irc\test.js:6:13)
test:error at Module._compile (internal/modules/cjs/loader.js:776:30)
test:error at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
test:error at Module.load (internal/modules/cjs/loader.js:643:32)
test:error at Function.Module._load (internal/modules/cjs/loader.js:556:12)
test:error at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
test:error at internal/main/run_main_module.js:17:11 +0ms
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.