better logging
This commit is contained in:
parent
4db9a8d53d
commit
d2fde5c38c
|
@ -428,23 +428,23 @@ app.get(urls.pairState, function (req, res) {
|
||||||
|
|
||||||
module.exports.webadmin = function (state, req, res) {
|
module.exports.webadmin = function (state, req, res) {
|
||||||
//if (!loaded) { loaded = true; app.use('/', state.defaults.webadmin); }
|
//if (!loaded) { loaded = true; app.use('/', state.defaults.webadmin); }
|
||||||
console.log('[DEBUG] extensions webadmin');
|
|
||||||
var host = (req.headers.host || '').toLowerCase().split(':')[0];
|
var host = (req.headers.host || '').toLowerCase().split(':')[0];
|
||||||
if (state.config.webminDomain === host) {
|
if (state.config.webminDomain === host) {
|
||||||
console.log("DEBUG going to static");
|
console.log("[static] " + req.headers.host + req.url);
|
||||||
staticApp(req, res);
|
staticApp(req, res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((state.config.apiDomain || ('api.' + state.config.webminDomain )) === host) {
|
if ((state.config.apiDomain || ('api.' + state.config.webminDomain )) === host) {
|
||||||
console.log("DEBUG going to api");
|
console.log("[api] " + req.headers.host + req.url);
|
||||||
req._state = state;
|
req._state = state;
|
||||||
app(req, res);
|
app(req, res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ('www.' + state.config.webminDomain === host) {
|
if ('www.' + state.config.webminDomain === host) {
|
||||||
console.log("DEBUG going to www");
|
console.log("[nowww] " + req.headers.host + req.url);
|
||||||
nowww(req, res);
|
nowww(req, res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.warn("[unhandled] " + req.headers.host + req.url);
|
||||||
res.end("Didn't recognize '" + escapeHtml(host) + "'. Not sure what to do.");
|
res.end("Didn't recognize '" + escapeHtml(host) + "'. Not sure what to do.");
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue