...
1
2
3 package log
4
5 import (
6 "fmt"
7 "os"
8 "strings"
9
10 "github.com/letsencrypt/boulder/core"
11 )
12
13
14
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 }
32
View as plain text