Add alsologtostderr option
When set sends log messages to the error log: sudo ./runsc --logtostderr do ls I0531 17:59:58.105064 144564 x:0] *************************** I0531 17:59:58.105087 144564 x:0] Args: [runsc --logtostderr do ls] I0531 17:59:58.105112 144564 x:0] PID: 144564 I0531 17:59:58.105125 144564 x:0] UID: 0, GID: 0 [...] PiperOrigin-RevId: 251964377
This commit is contained in:
parent
9ea248489b
commit
2e43dcb26b
|
@ -53,6 +53,7 @@ var (
|
|||
logFD = flag.Int("log-fd", -1, "file descriptor to log to. If set, the 'log' flag is ignored.")
|
||||
debugLogFD = flag.Int("debug-log-fd", -1, "file descriptor to write debug logs to. If set, the 'debug-log-dir' flag is ignored.")
|
||||
debugLogFormat = flag.String("debug-log-format", "text", "log format: text (default), json, or json-k8s")
|
||||
alsoLogToStderr = flag.Bool("alsologtostderr", false, "send log messages to stderr")
|
||||
|
||||
// Debugging flags: strace related
|
||||
strace = flag.Bool("strace", false, "enable strace")
|
||||
|
@ -228,6 +229,10 @@ func main() {
|
|||
e = newEmitter("text", ioutil.Discard)
|
||||
}
|
||||
|
||||
if *alsoLogToStderr {
|
||||
e = log.MultiEmitter{e, newEmitter(*debugLogFormat, os.Stderr)}
|
||||
}
|
||||
|
||||
log.SetTarget(e)
|
||||
|
||||
log.Infof("***************************")
|
||||
|
|
Loading…
Reference in New Issue