Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential for black-holing log messages via transitive dependency on gulplog #237

Open
ischneider opened this issue Jan 14, 2016 · 9 comments

Comments

@ischneider
Copy link

gulp-util.log checks for hasGulplog on module initialization and if present, defers logging to gulplog.info, which in turn will eat any messages below error (I believe) unless there is explicitly an event handler for the other levels (info, warn, etc.).

This can happen 'accidentally' if a transitive dependency uses gulplog.

It seems like the reasonable thing to do is to use gulplog.error to ensure all logging is output properly.

@phated
Copy link
Member

phated commented Jan 15, 2016

gulplog.info is the default log level for gulp-cli, which is why we used it (aligns with console.log). The only messages that aren't logged by default is gulplog.debug. However, I think you might actually be saying that some dependency is using gulplog, which makes it available in the global scope but you aren't using the new gulp-cli, so no logs are being logged. Is that correct?

@ischneider
Copy link
Author

However, I think you might actually be saying that some dependency is using gulplog, which makes it available in the global scope but you aren't using the new gulp-cli, so no logs are being logged. Is that correct?

Correct and I can verify that using the gulp executable from gulp-cli produces the desired behavior, i.e. gulp-util.log produces output even when gulplog is present.

This is fine longer term, but it seems like a potential problem for the unaware - case in point: me and my time lost :(

Super simple example

require('gulplog');
require('gulp-util').log('foobar');

When run using global gulp, no 'foobar'. When using locally installed gulp from gulp-cli, 'foobar' is logged.

Thanks 😄

@bdukes
Copy link
Contributor

bdukes commented Mar 20, 2017

Is the solution for gulp-util.log to check (the yet-to-be-created) hasGulpCli, instead of hasGulplog?

@ischneider
Copy link
Author

Is the solution for gulp-util.log to check (the yet-to-be-created) hasGulpCli, instead of hasGulplog?

It could be? Unfortunately, I've moved on and no longer use gulp in my day-to-day work.

@demurgos
Copy link
Member

I'd like to close this issue following the deprecation of plugin-error.
Is this problem still present? If so, where should this be moved, gulplog?

/cc @phated

@bdukes
Copy link
Contributor

bdukes commented Feb 1, 2018

Yes, this is still a gulplog issue, I've created an SSCCE at https://gist.github.com/bdukes/5d3d48321ba96f035311ee9f63aace70

@phated
Copy link
Member

phated commented Feb 1, 2018

This problem won't be solved until we get the community transferred off gulp installed globally and installing gulp-cli instead ☹️

@phated phated transferred this issue from gulpjs/gulp-util Sep 1, 2022
@sttk
Copy link
Contributor

sttk commented Feb 23, 2023

@phated Is this issue in gulp v4? Only v3?
Or does this issue occur as long as gulplog uses a global logger?

Is there anything we can do for this issue, though this is on the project board of v5.

@phated
Copy link
Member

phated commented Feb 28, 2023

I think this is always going to be a problem. It's on the "nice to have" for v5 in case someone comes up with a good solution.

@phated phated added this to post-v5 Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

5 participants