TUN-3795: Use RFC-3339 style date format for logs, produce timestamp in UTC

This commit is contained in:
Igor Postelnik
2021-01-21 14:30:02 -06:00
parent 7df3a1ab67
commit 0df4f7dd24
2 changed files with 26 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package origin
import (
"context"
"fmt"
"testing"
"time"
)
@@ -145,3 +146,16 @@ func TestBackoffRetryForever(t *testing.T) {
t.Fatalf("backoff returned %v instead of 8 seconds on fifth retry", duration)
}
}
func TestPrint(t *testing.T) {
local := time.Now()
fmt.Printf("Local = %s\n", local)
fmt.Printf("Local (kitchen) = %s\n", local.Format(time.Kitchen))
fmt.Printf("Local (RFC3339) = %s\n", local.Format(time.RFC3339))
fmt.Println()
utc := local.UTC()
fmt.Printf("UTC = %s\n", utc)
fmt.Printf("UTC (kitchen) = %s\n", utc.Format(time.Kitchen))
fmt.Printf("UTC (RFC3339) = %s\n", utc.Format(time.RFC3339))
}