Add 'Starting gVisor...' message to syslog

This allows applications to verify they are running with gVisor. It
also helps debugging when running with a mix of container runtimes.

Closes #54

PiperOrigin-RevId: 212059457
Change-Id: I51d9595ee742b58c1f83f3902ab2e2ecbd5cedec
This commit is contained in:
Fabricio Voznika
2018-09-07 16:59:27 -07:00
committed by Shentubot
parent 6cfb5cd56d
commit 172860a059
+7 -3
View File
@@ -86,14 +86,18 @@ func (s *syslog) Log() []byte {
return m
}
time := 0.0
const format = "<6>[%11.6f] %s\n"
s.msg = append(s.msg, []byte(fmt.Sprintf(format, 0.0, "Starting gVisor..."))...)
time := 0.1
for i := 0; i < 10; i++ {
time += rand.Float64() / 2
s.msg = append(s.msg, []byte(fmt.Sprintf("<6>[%11.6f] %s\n", time, selectMessage()))...)
s.msg = append(s.msg, []byte(fmt.Sprintf(format, time, selectMessage()))...)
}
time += rand.Float64() / 2
s.msg = append(s.msg, []byte(fmt.Sprintf("<6>[%11.6f] Ready!\n", time))...)
s.msg = append(s.msg, []byte(fmt.Sprintf(format, time, "Ready!"))...)
// Return a copy.
o := make([]byte, len(s.msg))