Skip to content

Commit

Permalink
Adding logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Oct 28, 2024
1 parent 765a34b commit b6cdfc0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/typing/ext/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ext
import (
"cmp"
"fmt"
"log/slog"
"time"
)

Expand Down Expand Up @@ -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()
}

Expand Down

0 comments on commit b6cdfc0

Please sign in to comment.