mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
runc init: pass _LIBCONTAINER_LOGLEVEL as int
Instead of passing _LIBCONTAINER_LOGLEVEL as a string (like "debug" or "info"), use a numeric value. Also, simplify the init log level passing code -- since we actually use the same level as the runc binary, just get it from logrus. This is a preparation for the next commit. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ func init() {
|
||||
runtime.GOMAXPROCS(1)
|
||||
runtime.LockOSThread()
|
||||
|
||||
logLevel, err := logrus.ParseLevel(os.Getenv("_LIBCONTAINER_LOGLEVEL"))
|
||||
level, err := strconv.Atoi(os.Getenv("_LIBCONTAINER_LOGLEVEL"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
logrus.SetLevel(logLevel)
|
||||
logrus.SetLevel(logrus.Level(level))
|
||||
logrus.SetOutput(os.NewFile(uintptr(logPipeFd), "logpipe"))
|
||||
logrus.SetFormatter(new(logrus.JSONFormatter))
|
||||
logrus.Debug("child process in init()")
|
||||
|
||||
Reference in New Issue
Block a user