mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Append ".txt" to runsc default debug log filenames.
PiperOrigin-RevId: 444592519
This commit is contained in:
committed by
gVisor bot
parent
ef9e8d9131
commit
cd2fca5a7a
@@ -416,13 +416,13 @@ func WaitForReady(pid int, timeout time.Duration, ready func() (bool, error)) er
|
||||
// ends with '/', it's used as a directory with default file name.
|
||||
// 'logPattern' can contain variables that are substituted:
|
||||
// - %TIMESTAMP%: is replaced with a timestamp using the following format:
|
||||
// <yyyymmdd-hhmmss.uuuuuu>
|
||||
// - %COMMAND%: is replaced with 'command'
|
||||
// - %TEST%: is replaced with 'test' (omitted by default)
|
||||
// <yyyymmdd-hhmmss.uuuuuu>
|
||||
// - %COMMAND%: is replaced with 'command'
|
||||
// - %TEST%: is replaced with 'test' (omitted by default)
|
||||
func DebugLogFile(logPattern, command, test string) (*os.File, error) {
|
||||
if strings.HasSuffix(logPattern, "/") {
|
||||
// Default format: <debug-log>/runsc.log.<yyyymmdd-hhmmss.uuuuuu>.<command>
|
||||
logPattern += "runsc.log.%TIMESTAMP%.%COMMAND%"
|
||||
// Default format: <debug-log>/runsc.log.<yyyymmdd-hhmmss.uuuuuu>.<command>.txt
|
||||
logPattern += "runsc.log.%TIMESTAMP%.%COMMAND%.txt"
|
||||
}
|
||||
logPattern = strings.Replace(logPattern, "%TIMESTAMP%", time.Now().Format("20060102-150405.000000"), -1)
|
||||
logPattern = strings.Replace(logPattern, "%COMMAND%", command, -1)
|
||||
|
||||
Reference in New Issue
Block a user