We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1bfc6e commit 66bd611Copy full SHA for 66bd611
pkg/context/context.go
@@ -8,6 +8,7 @@ package context
8
9
import (
10
"fmt"
11
+ "time"
12
13
"github.com/jaypipes/ghw/pkg/option"
14
"github.com/jaypipes/ghw/pkg/snapshot"
@@ -173,6 +174,11 @@ func (ctx *Context) Teardown() error {
173
174
return snapshot.Cleanup(ctx.snapshotUnpackedPath)
175
}
176
177
+// Warn Send warnings to log with timestamp
178
func (ctx *Context) Warn(msg string, args ...interface{}) {
179
ctx.alert.Printf("WARNING: "+msg, args...)
180
+ location, _ := time.LoadLocation("UTC")
181
+ timestamp := time.Now().In(location).Format("2006-01-02T15:04:05.000000-07:00")
182
+ formatedMsg := fmt.Sprintf("[%s] WARNING: %s", timestamp, msg)
183
+ ctx.alert.Printf(formatedMsg, args...)
184
0 commit comments