@@ -113,7 +113,7 @@ func logEntryFromLeaf(ctx context.Context, signer signature.Signer, tc TrillianC
113113 if attKey != "" {
114114 att , fetchErr = storageClient .FetchAttestation (ctx , attKey )
115115 if fetchErr != nil {
116- log .Logger .Errorf ("error fetching attestation by key, trying by UUID: %s %w" , attKey , fetchErr )
116+ log .ContextLogger ( ctx ) .Errorf ("error fetching attestation by key, trying by UUID: %s %w" , attKey , fetchErr )
117117 }
118118 }
119119 // if looking up by key failed or we weren't able to generate a key, try looking up by uuid
@@ -125,7 +125,7 @@ func logEntryFromLeaf(ctx context.Context, signer signature.Signer, tc TrillianC
125125 }
126126 att , fetchErr = storageClient .FetchAttestation (ctx , entryIDstruct .UUID )
127127 if fetchErr != nil {
128- log .Logger .Errorf ("error fetching attestation by uuid: %s %v" , entryIDstruct .UUID , fetchErr )
128+ log .ContextLogger ( ctx ) .Errorf ("error fetching attestation by uuid: %s %v" , entryIDstruct .UUID , fetchErr )
129129 }
130130 }
131131 if fetchErr == nil {
@@ -149,7 +149,7 @@ func GetLogEntryByIndexHandler(params entries.GetLogEntryByIndexParams) middlewa
149149 ctx := params .HTTPRequest .Context ()
150150 tid , resolvedIndex := api .logRanges .ResolveVirtualIndex (int (params .LogIndex ))
151151 tc := NewTrillianClientFromTreeID (ctx , tid )
152- log .RequestIDLogger ( params . HTTPRequest ).Debugf ("Retrieving resolved index %v from TreeID %v" , resolvedIndex , tid )
152+ log .ContextLogger ( ctx ).Debugf ("Retrieving resolved index %v from TreeID %v" , resolvedIndex , tid )
153153
154154 resp := tc .getLeafAndProofByIndex (resolvedIndex )
155155 switch resp .status {
@@ -238,12 +238,12 @@ func createLogEntry(params entries.CreateLogEntryParams) (models.LogEntry, middl
238238 go func () {
239239 keys , err := entry .IndexKeys ()
240240 if err != nil {
241- log .RequestIDLogger ( params . HTTPRequest ).Error (err )
241+ log .ContextLogger ( ctx ).Error (err )
242242 return
243243 }
244244 for _ , key := range keys {
245245 if err := addToIndex (context .Background (), key , entryID ); err != nil {
246- log .RequestIDLogger ( params . HTTPRequest ).Error (err )
246+ log .ContextLogger ( ctx ).Error (err )
247247 }
248248 }
249249 }()
@@ -254,14 +254,14 @@ func createLogEntry(params entries.CreateLogEntryParams) (models.LogEntry, middl
254254 go func () {
255255 attKey , attVal := entry .AttestationKeyValue ()
256256 if attVal == nil {
257- log .RequestIDLogger ( params . HTTPRequest ).Infof ("no attestation for %s" , uuid )
257+ log .ContextLogger ( ctx ).Infof ("no attestation for %s" , uuid )
258258 return
259259 }
260260 if err := storeAttestation (context .Background (), attKey , attVal ); err != nil {
261261 // entryIDstruct.UUID
262- log .RequestIDLogger ( params . HTTPRequest ).Errorf ("error storing attestation: %s" , err )
262+ log .ContextLogger ( ctx ).Errorf ("error storing attestation: %s" , err )
263263 } else {
264- log .RequestIDLogger ( params . HTTPRequest ).Infof ("stored attestation for uuid %s with filename %s" , entryIDstruct .UUID , attKey )
264+ log .ContextLogger ( ctx ).Infof ("stored attestation for uuid %s with filename %s" , entryIDstruct .UUID , attKey )
265265 }
266266 }()
267267 }
@@ -490,7 +490,7 @@ func retrieveUUIDFromTree(ctx context.Context, uuid string, tid int64) (models.L
490490 }
491491
492492 tc := NewTrillianClientFromTreeID (ctx , tid )
493- log .Logger .Debugf ("Attempting to retrieve UUID %v from TreeID %v" , uuid , tid )
493+ log .ContextLogger ( ctx ) .Debugf ("Attempting to retrieve UUID %v from TreeID %v" , uuid , tid )
494494
495495 resp := tc .getLeafAndProofByHash (hashValue )
496496 switch resp .status {
@@ -510,6 +510,7 @@ func retrieveUUIDFromTree(ctx context.Context, uuid string, tid int64) (models.L
510510 case codes .NotFound :
511511 return models.LogEntry {}, ErrNotFound
512512 default :
513+ log .ContextLogger (ctx ).Errorf ("Unexpected response code while attempting to retrieve UUID %v from TreeID %v: %v" , uuid , tid , resp .status )
513514 return models.LogEntry {}, errors .New ("unexpected error" )
514515 }
515516}
0 commit comments