Skip to content

Commit

Permalink
main: Pass runtime CLI command to vc logger
Browse files Browse the repository at this point in the history
Add the runtime CLI command name to the virtcontainers logger so that it
is clear when reading virtcontainers log entries which runtime command
they refer to.

Fixes kata-containers#448.

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Jul 5, 2018
1 parent 47dfb7d commit 830d50e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,17 @@ func beforeSubcommands(context *cli.Context) error {
return fmt.Errorf("unknown log-format %q", context.GlobalString("log-format"))
}

setExternalLoggers(kataLog)

ignoreLogging := false

// Add the name of the sub-command to each log entry for easier
// debugging.
cmdName := context.Args().First()
if context.App.Command(cmdName) != nil {
kataLog = kataLog.WithField("command", cmdName)
}

setExternalLoggers(kataLog)

ignoreLogging := false

if context.NArg() == 1 && context.Args()[0] == envCmd {
// simply report the logging setup
ignoreLogging = true
Expand Down

0 comments on commit 830d50e

Please sign in to comment.