Comments (8)
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
from lite-server.
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"
from lite-server.
👍 would love to have a way to hide those logs.
from lite-server.
I'd recommend to write your "lite" script like that:
"lite": "lite-server -c bs-config.json > /dev/null",
It works fine to me
from lite-server.
Thanks @houbenbert ! works like a charm!
from lite-server.
Thanks @GabrielDelepine, exactly what I needed!
from lite-server.
Any change to remove 200 and 304 code natively?
I have the same behaviour and I wish to made via bs-config.
Thanks
from lite-server.
A quick hack: lite-server configures the http request logger in lib\config-defaults.js which in turn uses the module 'connect-logger'
var log = require('connect-logger')
Intercept log messages by putting a wrapper around the log function:
var proxy = function(options) {
console.log('Proxy logger');
var targetLog = log(options);
return function(req, res, next) {
var originalEnd = res.end;
var targetNext = targetLog(req, res, next);
//res.end is now a new function
var targetEnd = res.end;
res.end = function(chunk, encoding) {
if (res.statusCode === 200 || res.statusCode === 304) {
res.end = originalEnd;
res.end(chunk, encoding);
return undefined;
} else {
return targetEnd(chunk, encoding);
}
};
return targetNext;
};
}
And in the middleware config replace log() with proxy():
proxy({ format: '%date %status %method %url' })
A bit painful because of the nesting hell. Probably a simpler solution but works for me
from lite-server.
Related Issues (20)
- Installation fails E429 too many Requests HOT 1
- Not listening on this port
- npm audit found vulnerabilities HOT 1
- npm is not started started script missing HOT 1
- i m trying to run npm start command but it is giving following error
- Problem with npm install HOT 2
- unable to start lite-server on wsl2 HOT 1
- Error using lite-server for create-react-app HOT 3
- The package needs to update axios to solve high severity vulnerability HOT 1
- Disable SPA handling? HOT 1
- lite-server doesn't trigger or reload the page when I save the page after adding something .
- CORS 404 OPTIONS HOT 2
- How to get Directory Listing working?
- Trying to start an html website using NPM and Lite-server HOT 2
- lite-server not installing using (npm install lite-server -g) HOT 1
- Lite-server dependecies are vulnerable (The Async package have a vulnerability)
- lite-server generating three Uncaught (in promise) errors after each reload
- Lite server disables CDN links
- Static files and api proxy HOT 1
- npm & github recommend not using: "All versions of package lite-server are vulnerable to Denial of Service"
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 lite-server.