Comments (12)
requires localStorage in the browser
good to know. Want to do a pr? Or I can swap it the next time I make changes. thanks
edit: same on the other two related issues, thanks for letting me know
from nanomatch.
also fwiw, the main reason I'm using debug (or debuglog) is that it seems to have gotten more difficult to figure out which modules is actually being called by node. Even though flattening was supposed to make things easier, that hasn't been my own experience. If you have other suggestions for this maybe we don't even need debug.
from nanomatch.
I'm poking around on some other stuff today. I'll circle around at some point
from nanomatch.
no prob. I'm adding unit tests to this right now anyway, I went ahead and made this change already
from nanomatch.
actually I'm just going to remove debug, since this would defeat the whole purpose and advantage of it, which is that you can just do DEBUG=*
and it works for any and all modules in the dependency tree that use debug. I'd have to document the API/usage differences and it would need to be used by every lib in the tree for it to be useful, but the debuglog
api doesn't have parity and isn't as useful. Also, fwiw, there a ton of libs using debug, I don't see how not having it here would have any appreciable change (I have to imagine there are several libs in the vinyl/gulp trees that use debug, given how popular and useful it is).
anyway, fwiw, this seems more like (yet another) bug in webpack / browserify. It seems like too many people are expecting node.js libraries to support those tools, but I'm having a hard time understanding why that makes any sense at all. I remember when I first started using node, and it seemed like all of the libs were written to be used in the browser or with jquery. Then code started getting cleaner when node conventions became more popular. It seems like node libs should be idiomatic for node usage, and those libraries should find a way to work with that, either by fixing the bug, or creating a browserify or webpack plugin/filter that removes the browser version of debug.
just my 2c
edit: if you think about it, node.js will turn into even more of a cluster*%$# if people start writing their code around webpack and browserify. I really hope that doesn't happen.
from nanomatch.
- It's not a problem in any tool, but a problem in the runtime (chrome apps); however, we aren't in a position to change that but we are in a position to be wary of our dependencies.
debug
is probably the worst logging tool in the ecosystem. It doesn't have log levels, pluggable output, etc. I'm guessing people just use it because it was one of the first things out when many joined the ecosystem.- People are already writing code around webpack and browserify (see the react ecosystem) and publishing to npm.
from nanomatch.
well, it goes without saying that most good developers have strong opinions, and for good reason lol.
we are in a position to be wary of our dependencies
Every maintainer is in this position. We might continue to disagree on this debug point, but I'm clearly making a concession by removing debug to accommodate your request, and the point you're implying is not lost on me.
debug is probably the worst logging tool in the ecosystem.
I imagine it is, given that it's not promoted as an alternative for a logging tool. Honestly - aside from the browserify/webpack issues - maybe your dislike for the module is based on a misunderstanding of it's purpose. My interpretation is that it's a debugging tool, and it's used for something completely different than logging. Levels and such don't really seem to make any sense for debug (especially given that you can create namespaces using whatever custom code you want. I've actually created custom logging levels for an implementation of debug in the past). But I wouldn't use it as a replacement for a good logging tool.
People are already writing code around webpack and browserify (see the react ecosystem) and publishing to npm.
Which makes complete sense if those libs are written for webpack, browersify or react and they prefix the module names with webpack-
, browserify-
and react-
. If they don't then they are cluttering up the ecosystem with bait-and-switch tools that are not generalized for node.js usage. What's the difference between that and publishing gulp plugins without the word gulp-
in the name? Or encouraging people to publish their modules as grunt plugins?
Anyway, I think this is getting off of the point of this issue, which I've already resolved. Also, it might be good to know that there are prs open on debug that fix the browser issues.
from nanomatch.
@jonschlinkert just wanted to say that I wasn't trying to be adversarial. Thanks for addressing this and for everything you do. Have a great weekend!
from nanomatch.
@phated thank you for saying that. I appreciate you too, I think you're a great maintainer and I know how much you care about the quality of your projects. have a great weekend as well!
from nanomatch.
not wanting to continue the discussion, it is perfectly clear for me. just wanting to point that many "gulp plugins" are just streams and are incorrectly prefixed with gulp-.
j2c, hf : ) no bad feelings
from nanomatch.
@phated @jonschlinkert
Ok this is a very interesting discussion! I actually built a logger that offers more functionality then debug, but is smaller at the same time (~1kB minified and gzipped). It's called ulog if you are interested.
this would defeat the whole purpose and advantage of it, which is that you can just do DEBUG=* and it works for any and all modules in the dependency tree that use debug.
Exactly! Which is why ulog
has adopted this exact functionality and brought it to the browser. On Node, you can set LOG=warn
or whatever to set a global log level, or you can set individual modules to level debug with the old and trusted DEBUG=my-module
syntax. On the browser, you can specify ?log=info
or ?debug=my-module
, or even ?log=info&debug=my-module
in the querystring. I've been using it for a while and it works really well if I do say so myself :)
from nanomatch.
Oh and one more thing... I've found a convenient pattern for using ulog
(or debug
for that matter) without forcing it down the library user's throat. It uses ulog only when installed separately by the user of the library. In the library itself, you install ulog as a dev dependency. Then you import it like this:
var log = {name: 'my-module'};
try {
log = require('ulog')(log.name);
}
catch(e) {
function nop(){}
log = Object.assign(log, console, {debug:nop, log:nop});
}
This way, you get a logger object with a name
and debug
and log
methods that you can just use. If ulog
is installed, the default log level will ensure your log
and debug
messages are not printed. If ulog
is not installed, log
and debug
will be no-ops, but info
, warn
and error
are still available.
I'd be happy to cook up a PR for you to add ulog to this project if you'd like.
from nanomatch.
Related Issues (20)
- ... HOT 3
- Drop support for node 0.10, 0.12 and maybe more? HOT 8
- Pattern with plus not works as expected HOT 2
- Getting errors with jest - nanomatch issue? HOT 8
- v1.2.11 breaks micromatch HOT 33
- Git repo not up to date HOT 1
- Certain globs ending with "non-word" characters fail to match HOT 7
- Any way to see the patterns that are matching when using an array of patterns?
- Trailing slash discrepancy with micromatch HOT 2
- Typecript typings HOT 1
- High severity vulnerabilities are reported for v1.2.13 HOT 11
- Vulnerability in dependency "set-value" (High Severity) HOT 2
- Vunerability due to using Kind Of 6.0.2 HOT 1
- How to include a file from an excluded directory? HOT 1
- Dependency vulnerability HOT 1
- publish 1.0 HOT 2
- npm info show only 1.2.0 as the new version HOT 1
- consistently handle leading dot-slash
- regex-not 1.0.1 is broken HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nanomatch.