gulp-cli icon indicating copy to clipboard operation
gulp-cli copied to clipboard

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

Open ischneider opened this issue 9 years ago • 9 comments

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.

ischneider avatar Jan 14 '16 19:01 ischneider

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?

phated avatar Jan 15 '16 19:01 phated

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 :smile:

ischneider avatar Jan 19 '16 17:01 ischneider

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

bdukes avatar Mar 20 '17 21:03 bdukes

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.

ischneider avatar Mar 20 '17 23:03 ischneider

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

demurgos avatar Jan 26 '18 23:01 demurgos

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

bdukes avatar Feb 01 '18 15:02 bdukes

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

phated avatar Feb 01 '18 18:02 phated

@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.

sttk avatar Feb 23 '23 04:02 sttk

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 avatar Feb 28 '23 02:02 phated