github.com/letsencrypt/boulder@v0.20251208.0/log/prod_prefix.go (about) 1 //go:build !integration 2 3 package log 4 5 import ( 6 "fmt" 7 "os" 8 "strings" 9 10 "github.com/letsencrypt/boulder/core" 11 ) 12 13 // getPrefix returns the prefix and clkFormat that should be used by the 14 // stdout logger. 15 func getPrefix() (string, string) { 16 shortHostname := "unknown" 17 datacenter := "unknown" 18 hostname, err := os.Hostname() 19 if err == nil { 20 splits := strings.SplitN(hostname, ".", 3) 21 shortHostname = splits[0] 22 if len(splits) > 1 { 23 datacenter = splits[1] 24 } 25 } 26 27 prefix := fmt.Sprintf("%s %s %s[%d]: ", shortHostname, datacenter, core.Command(), os.Getpid()) 28 clkFormat := "2006-01-02T15:04:05.000000+00:00Z" 29 30 return prefix, clkFormat 31 }