mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #2911 from kolyshkin/debug-enable-file-line
logging: enable file/line info if --debug is set
This commit is contained in:
@@ -24,6 +24,7 @@ type Config struct {
|
||||
LogFormat string
|
||||
LogFilePath string
|
||||
LogPipeFd int
|
||||
LogCaller bool
|
||||
}
|
||||
|
||||
func ForwardLogs(logPipe io.ReadCloser) chan error {
|
||||
@@ -77,6 +78,7 @@ func ConfigureLogging(config Config) error {
|
||||
}
|
||||
|
||||
logrus.SetLevel(config.LogLevel)
|
||||
logrus.SetReportCaller(config.LogCaller)
|
||||
|
||||
// XXX: while 0 is a valid fd (usually stdin), here we assume
|
||||
// that we never deliberately set LogPipeFd to 0.
|
||||
|
||||
@@ -190,6 +190,7 @@ func createLogConfig(context *cli.Context) logs.Config {
|
||||
LogLevel: logrus.InfoLevel,
|
||||
LogFilePath: logFilePath,
|
||||
LogFormat: context.GlobalString("log-format"),
|
||||
LogCaller: context.GlobalBool("debug"),
|
||||
}
|
||||
if context.GlobalBool("debug") {
|
||||
config.LogLevel = logrus.DebugLevel
|
||||
|
||||
Reference in New Issue
Block a user