TUN-1419: Identify request/response headers/content length with ray ID

This commit is contained in:
Chung-Ting Huang
2019-01-28 14:05:59 -06:00
parent 61cd4a918d
commit 47c878b9c4
3 changed files with 31 additions and 9 deletions

View File

@@ -534,7 +534,7 @@ func tunnelFlags(shouldHide bool) []cli.Flag {
altsrc.NewStringFlag(&cli.StringFlag{
Name: "loglevel",
Value: "info",
Usage: "Application logging level {panic, fatal, error, warn, info, debug}",
Usage: "Application logging level {panic, fatal, error, warn, info, debug}. " + debugLevelWarning,
EnvVars: []string{"TUNNEL_LOGLEVEL"},
Hidden: shouldHide,
}),

View File

@@ -13,6 +13,9 @@ import (
"github.com/pkg/errors"
)
const debugLevelWarning = "At debug level, request URL, method, protocol, content legnth and header will be logged. " +
"Response status, content length and header will also be logged in debug level."
var logger = log.CreateLogger()
func configMainLogger(c *cli.Context) error {
@@ -22,6 +25,9 @@ func configMainLogger(c *cli.Context) error {
return errors.Wrap(err, "Unknown logging level specified")
}
logger.SetLevel(logLevel)
if logLevel == logrus.DebugLevel {
logger.Warn(debugLevelWarning)
}
return nil
}