Skip to content

Commit 2d9b449

Browse files
committed
added proxy logging
1 parent f1b05ef commit 2d9b449

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

bin/http-server

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ if (!argv.s && !argv.silent) {
111111
chalk.red(error.status.toString()), chalk.red(error.message)
112112
);
113113
}
114+
else if (req.proxy) {
115+
logger.info(
116+
'[%s] %s "%s" (%s)-> "%s"',
117+
date, ip, chalk.cyan(req.url), chalk.magenta('Proxy'), chalk.cyan(req.proxy.target)
118+
);
119+
}
114120
else {
115121
logger.info(
116122
'[%s] %s "%s %s" "%s"',

lib/http-server.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ function HttpServer(options) {
146146
}
147147

148148
if (req.proxy) {
149+
if (options.logFn) {
150+
options.logFn(req, res);
151+
}
149152
proxy.web(req, res, req.proxy, function (err, req, res) {
150153
if (options.logFn) {
151154
options.logFn(req, res, {

0 commit comments

Comments
 (0)