diff --git a/common/version.go b/common/version.go index ced2e5a8c..90d9c61f8 100644 --- a/common/version.go +++ b/common/version.go @@ -6,7 +6,6 @@ import ( "os" "os/user" "runtime" - "strconv" "strings" "time" @@ -36,7 +35,8 @@ type ClientSessionIdentityT struct { // String is the stringer fn for ClientSessionIdentityT func (s *ClientSessionIdentityT) String() string { - return fmt.Sprint(s.Goos, s.Goarch, s.SessionID, s.Hostname, s.Username, s.MachineID, strconv.Itoa(s.Pid)) + return fmt.Sprintf("VERSION=%s GO=%s GOOS=%s GOARCH=%s SESSIONID=%s HOSTNAME=%s USER=%s MACHINE=%s PID=%d", + s.Version, s.Goversion, s.Goos, s.Goarch, s.SessionID, s.Hostname, s.Username, s.MachineID, s.Pid) } // Helpers for random sessionid string. diff --git a/logger/glog/glog.go b/logger/glog/glog.go index 6d7869174..5f131b1d2 100644 --- a/logger/glog/glog.go +++ b/logger/glog/glog.go @@ -121,6 +121,7 @@ import ( "sync/atomic" "time" + "github.com/ethereumproject/go-ethereum/common" "github.com/fatih/color" ) @@ -1159,8 +1160,8 @@ func (sb *syncBuffer) rotateCurrent(now time.Time) error { // Write header. var buf bytes.Buffer fmt.Fprintf(&buf, "Log file created at: %s\n", now.Format("2006/01/02 15:04:05")) - fmt.Fprintf(&buf, "Running on machine: %s\n", host) fmt.Fprintf(&buf, "Binary: Built with %s %s for %s/%s\n", runtime.Compiler, runtime.Version(), runtime.GOOS, runtime.GOARCH) + fmt.Fprintf(&buf, "Context: %s\n", common.GetClientSessionIdentity().String()) fmt.Fprintf(&buf, "Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg\n") n, err := sb.file.Write(buf.Bytes()) sb.nbytes += uint64(n)