From b6cdfc0bdb32cfc0e8e1930a0831126913b8f73b Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Sun, 27 Oct 2024 17:25:07 -0700 Subject: [PATCH] Adding logging. --- lib/typing/ext/time.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/typing/ext/time.go b/lib/typing/ext/time.go index bc10cb02f..10667e897 100644 --- a/lib/typing/ext/time.go +++ b/lib/typing/ext/time.go @@ -3,6 +3,7 @@ package ext import ( "cmp" "fmt" + "log/slog" "time" ) @@ -54,7 +55,9 @@ type ExtendedTime struct { // MarshalJSON is a custom JSON marshaller for ExtendedTime. // This is only used for nested MongoDB objects where there may be nested DateTime values. func (e ExtendedTime) MarshalJSON() ([]byte, error) { - // This is consistent with how MongoDB's Go driver marshals time.Time + // Delete this function once we delete [ExtendedTime]. + // This should not be happening anymore since MongoDB is now using [time.Time] + slog.Error("Unexpected call to MarshalJSON()", slog.Any("ts", e.ts), slog.String("nestedKindType", string(e.nestedKind.Type))) return e.ts.UTC().MarshalJSON() }