question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to stop verbose output to the console

See original GitHub issue

I have lite-server setup in package.json:

"scripts": {
    "start": "concurrently \"npm run tsc:w\" \"npm run scss:w\" \"npm run lite\" ",
    "tsc": "tsc --inlineSourceMap --allowSyntheticDefaultImports -outDir .build/js",
    "tsc:w": "tsc -w --inlineSourceMap --allowSyntheticDefaultImports -outDir .build/js",
    "scss": "node-sass --include-path styles/app.scss .build/css/app.css",
    "scss:w": "node-sass -w --include-path styles styles/app.scss .build/css/app.css",
    "lite": "lite-server -c bs-config.json",
    "typings": "typings",
    "postinstall": "typings install"
  },

with the following bs-config.json file:

{
    "notify": false,
    "files": ["./.build/css/*.css", "./.build/js/**/*.js", "./app/**/*.{html,css}", "index.html"],
    "injectChanges": true,
    "logLevel": "silent",
    "debugInfo": false,
    "ghostMode": false,
     "server": { "baseDir": "." }
}

Upon starting I see that the bs-config.json configuration is written to te console:

** browser-sync config **
[2] { injectChanges: true,
[2]   files: 
[2]    [ './.build/css/*.css',
[2]      './.build/js/**/*.js',
[2]      './app/**/*.{html,css}',
[2]      'index.html' ],
[2]   watchOptions: { ignored: 'node_modules' },
[2]   server: { baseDir: '.', middleware: [ [Function], [Function] ] },
[2]   notify: false,
[2]   logLevel: 'silent',
[2]   debugInfo: false,
[2]   ghostMode: false }
[0] 8:02:46 AM - Compilation complete. Watching for file changes.

Since the logLevel is set to silent, I expect to see very little info in the console. However, each and every get is displayed:

[2] 16.04.23 08:02:50 200 GET /index.html
[2] 16.04.23 08:02:50 304 GET /node_modules/bootstrap/dist/css/bootstrap.min.css
[2] 16.04.23 08:02:50 304 GET /node_modules/font-awesome/css/font-awesome.min.css
[2] 16.04.23 08:02:50 304 GET /node_modules/ng2-notify/dist/css/ng2notify.css
[2] 16.04.23 08:02:50 304 GET /.build/css/app.css
[2] 16.04.23 08:02:50 304 GET /node_modules/es6-shim/es6-shim.min.js
[2] 16.04.23 08:02:50 304 GET /node_modules/angular2/bundles/angular2-polyfills.js
[2] 16.04.23 08:02:50 304 GET /node_modules/systemjs/dist/system-polyfills.js
[2] 16.04.23 08:02:50 304 GET /node_modules/angular2/es6/dev/src/testing/shims_for_IE.js
[2] 16.04.23 08:02:50 304 GET /node_modules/systemjs/dist/system.src.js
[2] 16.04.23 08:02:50 304 GET /node_modules/rxjs/bundles/Rx.js
[2] 16.04.23 08:02:50 304 GET /node_modules/angular2/bundles/angular2.dev.js
etc...

Environment

  • lite-server version: 2.2.0
  • nodejs version: 5.7.1
  • npm version: 3.8.0
  • OS type/version: OSX

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

4reactions
houbenbertcommented, Jun 14, 2016

If you do not want to see all HTTP requests, you will need to disable the logging middleware as described in README.md.

So in stead of a bs-config.json , use a bs-config.js file like this one:

module.exports = {
  logLevel: "silent",
  server: {
    middleware: {
      0: null
    }
  }
};

the 0:null clears out the first middleware, which is the logger. You might still want to set the logLevel to “silent” or “debug” as well, since browsersync by itself can be quite verbose as well

1reaction
GabrielDelepinecommented, Jul 13, 2016

Personally I wanted to keep the middleware logger, but hide the success response. So I finally use npm start |grep -v "200" |grep -v "304"

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reducing the console output of LaTeX - TeX
Either use the -interaction batchmode switch or put \batchmode at the start of the document(or anywhere you want to stop displaying output).
Read more >
Disable verbose output on build - Stack Overflow
To exclude only path , you would need to modify the Packages/Default/exec.py file. Under the ExecCommand class, run method, look for self.
Read more >
Discarding Output - powershell.one
To silence direct console output and discard all output, you can temporarily disable the internal PowerShell command Out-Default .
Read more >
Toggle debug, verbose and information level output on and off ...
Toggle $DebugPreference, $VerbosePreference and $InformationPreference in PowerShell between Continue and Silently Continue with a ...
Read more >
Stop all output messages to console - PyMC Discourse
... way to stop all of the output, to the console, that comes from pymc3? I've turned off progressbar and tried verbose=0 and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found