MCPcopy Create free account
hub / github.com/coder/slog / StripTimestamp

Function StripTimestamp

internal/entryhuman/entry.go:29–34  ·  view source on GitHub ↗

StripTimestamp strips the timestamp from entry and returns it and the rest of the entry.

(ent string)

Source from the content-addressed store, hash-verified

27// StripTimestamp strips the timestamp from entry and returns
28// it and the rest of the entry.
29func StripTimestamp(ent string) (time.Time, string, error) {
30 ts := ent[:len(TimeFormat)]
31 rest := ent[len(TimeFormat):]
32 et, err := time.Parse(TimeFormat, ts)
33 return et, rest, err
34}
35
36// TimeFormat is a simplified RFC3339 format.
37const TimeFormat = "2006-01-02 15:04:05.000"

Callers 2

TestStdlibFunction · 0.92
TestMakeFunction · 0.92

Calls

no outgoing calls

Tested by 2

TestStdlibFunction · 0.74
TestMakeFunction · 0.74