Skip to content

Commit 9472e7f

Browse files
committed
log: render happydns.Identifier values via .String() in log messages
1 parent c411d6b commit 9472e7f

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

internal/api/controller/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (cc *CheckerController) TriggerCheck(c *gin.Context) {
244244
} else {
245245
go func() {
246246
if _, err := cc.engine.RunExecution(context.WithoutCancel(c.Request.Context()), exec, plan, req.Options); err != nil {
247-
log.Printf("async RunExecution error for checker %q execution %v: %v", cname, exec.Id, err)
247+
log.Printf("async RunExecution error for checker %q execution %s: %v", cname, exec.Id.String(), err)
248248
}
249249
}()
250250
c.JSON(http.StatusAccepted, exec)

internal/api/middleware/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func SameUserHandler(c *gin.Context) {
7575
user := c.MustGet("user").(*happydns.User)
7676

7777
if !bytes.Equal(user.Id, myuser.Id) {
78-
log.Printf("%s: tries to do action as %s (logged %s)", c.ClientIP(), myuser.Id, user.Id)
78+
log.Printf("%s: tries to do action as %s (logged %s)", c.ClientIP(), myuser.Id.String(), user.Id.String())
7979
c.AbortWithStatusJSON(http.StatusForbidden, happydns.ErrorResponse{Message: "Not authorized"})
8080
return
8181
}

internal/usecase/checker/scheduler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ func (s *Scheduler) NotifyDomainRemoved(domainID happydns.Identifier) {
627627
s.mu.Unlock()
628628

629629
if n > 0 {
630-
log.Printf("Scheduler: NotifyDomainRemoved(%s): removed %d jobs", domainID, n)
630+
log.Printf("Scheduler: NotifyDomainRemoved(%s): removed %d jobs", domainID.String(), n)
631631
}
632632
}
633633

@@ -741,7 +741,7 @@ func (s *Scheduler) loadDomainServices(domain *happydns.Domain) []*happydns.Serv
741741
}
742742
zone, err := s.zoneStore.GetZone(domain.ZoneHistory[idx])
743743
if err != nil {
744-
log.Printf("Scheduler: failed to load zone %s for domain %s: %v", domain.ZoneHistory[idx], domain.DomainName, err)
744+
log.Printf("Scheduler: failed to load zone %s for domain %s: %v", domain.ZoneHistory[idx].String(), domain.DomainName, err)
745745
continue
746746
}
747747
for _, svcs := range zone.Services {

internal/usecase/orchestrator/zone_correction_applier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (uc *ZoneCorrectionApplierUsecase) Apply(
209209
if len(domain.ZoneHistory) > 1 {
210210
prevZone, prevErr := uc.zoneGetter.Get(domain.ZoneHistory[1])
211211
if prevErr != nil {
212-
log.Printf("ReassociateMetadata: unable to load previous zone %s: %s (metadata will not be transferred)", domain.ZoneHistory[1], prevErr)
212+
log.Printf("ReassociateMetadata: unable to load previous zone %s: %s (metadata will not be transferred)", domain.ZoneHistory[1].String(), prevErr)
213213
} else {
214214
zoneUC.ReassociateMetadata(prevZone.Services, services, domain.DomainName, defaultTTL)
215215
}

internal/usecase/orchestrator/zone_importer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (uc *ZoneImporterUsecase) Import(user *happydns.User, domain *happydns.Doma
6262
if len(domain.ZoneHistory) > 0 {
6363
prevZone, err := uc.zoneGetter.Get(domain.ZoneHistory[0])
6464
if err != nil {
65-
log.Printf("ReassociateMetadata: unable to load previous zone %s: %s (metadata will not be transferred)", domain.ZoneHistory[0], err)
65+
log.Printf("ReassociateMetadata: unable to load previous zone %s: %s (metadata will not be transferred)", domain.ZoneHistory[0].String(), err)
6666
} else {
6767
zoneUC.ReassociateMetadata(prevZone.Services, services, domain.DomainName, defaultTTL)
6868
}

0 commit comments

Comments
 (0)