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

logFileChanges has no effect #479

Closed
thebuilder opened this issue Feb 25, 2015 · 8 comments · May be fixed by tobybellwood/govstrap#4
Closed

logFileChanges has no effect #479

thebuilder opened this issue Feb 25, 2015 · 8 comments · May be fixed by tobybellwood/govstrap#4
Labels

Comments

@thebuilder
Copy link
Contributor

Hi

I set up a basic BrowserSync server task in a gulp project, and i set the option "logFileChanges" to false. This however seems to have no effect. It still logs out whenever a file change:

[BrowserSync] File changed: css/app.css

My BrowserSync task currently looks like this:

module.exports = function(done) {
    var browserSync = require('browser-sync');
    var watch = require('gulp-watch');
    var config  = require('../config');

    //See http://www.browsersync.io/docs/options/ for all options
    var options = {
        server: {
            baseDir: "./" + config.dist
        },
        port: config.server.port,

        logLevel: 'info',
        logPrefix: "BrowserSync",
        logFileChanges: false,
        notify: true
    };

    //Start the BrowserSync server
    browserSync(options, function(err, bs) {
        //BrowserSync running
        done();
    });

    //Watch for changes and reload BrowserSync
    watch(config.dist + '**/*.*', function(file) {
        browserSync.reload(file.relative);
    })
};
@thebuilder
Copy link
Contributor Author

Tried monitoring the file.reload event:

browserSync.emitter.on("file:reload", function (e) {
    console.log(e);
});

In the output event, log is true, so the logger of course logs the change.

{
  assetFileName: 'app.css',
  fileExtension: 'css',
  cwd: ...,
  path: 'css/app.css',
  type: 'inject',
  log: true 
}

@thebuilder
Copy link
Contributor Author

Tried to change the browserSync.reload to use stream. This results in the file.reload event not triggering at all, so now the logFileChanges doesn't log anything even if it's set to true.

The notifications in the browser still show the file that changed. Is this intended for streaming?

watch(config.dist + '**/*.*')
    .pipe(browserSync.reload({stream:true}));

@shakyShane shakyShane added the bug label Feb 26, 2015
@shakyShane
Copy link
Contributor

logFileChanges currently only applies when using BrowserSync's internal file-watcher, but yes, it should also apply to stream-initiated events.

Thanks for reporting, we'll get it fixed asap

@thebuilder
Copy link
Contributor Author

Any progress on this?:) It's a general issue for all browserSync.reload calls.
Trying to declutter the terminal output, it is a bit annoying to have it filled with lines of "[BrowserSync] Reloading Browsers..."

I would be more interested in knowing if it failed to reload the browsers.

On a similar note, setting logLevel to "warn" appears to have no effect.
I do like the "Access URLs" log snippet, but would prefer to keep the remaining output to warnings.

@shakyShane
Copy link
Contributor

This is scheduled for next round of bug fixes :)

@shakyShane
Copy link
Contributor

Or if you would like to make this happen sooner, we love pull requests.

I'm thinking the issue is mainly here https://github.com/BrowserSync/browser-sync/blob/master/lib/logger.js#L41-L56

Could be as easy as checking the option along with the data.log property

@redwan10
Copy link

Thanks, guys. Your discussion helps me to find a solution. Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants