Skip to content

Commit

Permalink
Merge pull request #2911 from kolyshkin/debug-enable-file-line
Browse files Browse the repository at this point in the history
logging: enable file/line info if --debug is set
  • Loading branch information
AkihiroSuda authored Apr 28, 2021
2 parents fac8492 + 9f3d753 commit c2c35ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libcontainer/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Config struct {
LogFormat string
LogFilePath string
LogPipeFd int
LogCaller bool
}

func ForwardLogs(logPipe io.ReadCloser) chan error {
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2c35ae

Please sign in to comment.