var ExitFlushTimeout … var OsExit … // FlushAndExit flushes log data for a certain amount of time and then calls // os.Exit. Combined with some logging call it provides a replacement for // traditional calls like Fatal or Exit. func FlushAndExit(flushTimeout time.Duration, exitCode int) { … } // timeoutFlush calls Flush and returns when it completes or after timeout // elapses, whichever happens first. This is needed because the hooks invoked // by Flush may deadlock when klog.Fatal is called from a hook that holds // a lock. Flushing also might take too long. func timeoutFlush(timeout time.Duration) { … }