mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 17:22:33 +00:00
logging: Add function to handle external loggers
Created a new `setExternalLogger()` which sets (or resets) the logger used by the external packages which allow a logger to be specified. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
79e8da0675
commit
03d4d4937c
16
cli/main.go
16
cli/main.go
@ -187,6 +187,16 @@ func setupSignalHandler() {
|
||||
}()
|
||||
}
|
||||
|
||||
// setExternalLoggers registers the specified logger with the external
|
||||
// packages which accept a logger to handle their own logging.
|
||||
func setExternalLoggers(logger *logrus.Entry) {
|
||||
// Set virtcontainers logger.
|
||||
vci.SetLogger(logger)
|
||||
|
||||
// Set the OCI package logger.
|
||||
oci.SetLogger(logger)
|
||||
}
|
||||
|
||||
// beforeSubcommands is the function to perform preliminary checks
|
||||
// before command-line parsing occurs.
|
||||
func beforeSubcommands(context *cli.Context) error {
|
||||
@ -225,11 +235,7 @@ func beforeSubcommands(context *cli.Context) error {
|
||||
return fmt.Errorf("unknown log-format %q", context.GlobalString("log-format"))
|
||||
}
|
||||
|
||||
// Set virtcontainers logger.
|
||||
vci.SetLogger(kataLog)
|
||||
|
||||
// Set the OCI package logger.
|
||||
oci.SetLogger(kataLog)
|
||||
setExternalLoggers(kataLog)
|
||||
|
||||
ignoreLogging := false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user