@@ -70,11 +70,11 @@ func LoadRepository(ctx context.Context, repoPath string) (*Repository, error) {
7070 // Load cache pb file of the repo if exist
7171 if c , err := loadRepositoryCache (cachePath ); err == nil {
7272 cache = c
73- logger .InfoContext (ctx , "Loaded repository cache" , slog .String ( "url" , ctx . Value ( urlKey ).( string )), slog . Int ("commits" , len (cache .GetCommits ())))
73+ logger .InfoContext (ctx , "Loaded repository cache" , slog .Int ("commits" , len (cache .GetCommits ())))
7474 } else {
7575 if errors .Is (err , os .ErrNotExist ) {
7676 // It's fine if cache doesn't exist, log it just in case
77- logger .InfoContext (ctx , "No repository cache found" , slog . String ( "url" , ctx . Value ( urlKey ).( string )) )
77+ logger .InfoContext (ctx , "No repository cache found" )
7878 } else {
7979 return nil , fmt .Errorf ("failed to load repository cache: %w" , err )
8080 }
@@ -94,7 +94,7 @@ func LoadRepository(ctx context.Context, repoPath string) (*Repository, error) {
9494
9595 // Save cache
9696 if err := saveRepositoryCache (cachePath , repo ); err != nil {
97- logger .ErrorContext (ctx , "Failed to save repository cache" , slog .String ( "url" , ctx . Value ( urlKey ).( string )), slog . Any ("err" , err ))
97+ logger .ErrorContext (ctx , "Failed to save repository cache" , slog .Any ("err" , err ))
9898 }
9999
100100 return repo , nil
@@ -104,7 +104,7 @@ func LoadRepository(ctx context.Context, repoPath string) (*Repository, error) {
104104// Returns a list of new commit hashes that don't have cached Patch IDs.
105105// The new commit list is in reverse chronological order based on commit date (the default for git log).
106106func (r * Repository ) buildCommitGraph (ctx context.Context , cache * pb.RepositoryCache ) ([]SHA1 , error ) {
107- logger .InfoContext (ctx , "Starting graph construction" , slog . String ( "url" , ctx . Value ( urlKey ).( string )) )
107+ logger .InfoContext (ctx , "Starting graph construction" )
108108 start := time .Now ()
109109
110110 // Build cache map
@@ -174,7 +174,7 @@ func (r *Repository) buildCommitGraph(ctx context.Context, cache *pb.RepositoryC
174174 for _ , parent := range parents {
175175 hash , err := hex .DecodeString (parent )
176176 if err != nil {
177- logger .ErrorContext (ctx , "Failed to decode hash" , slog .String ("url" , ctx . Value ( urlKey ).( string )), slog . String ( " parent" , parent ), slog .Any ("err" , err ))
177+ logger .ErrorContext (ctx , "Failed to decode hash" , slog .String ("parent" , parent ), slog .Any ("err" , err ))
178178 continue
179179 }
180180 parentHashes = append (parentHashes , SHA1 (hash ))
@@ -184,13 +184,13 @@ func (r *Repository) buildCommitGraph(ctx context.Context, cache *pb.RepositoryC
184184 case 1 :
185185 hash , err := hex .DecodeString (commitInfo [0 ])
186186 if err != nil {
187- logger .ErrorContext (ctx , "Failed to decode hash" , slog .String ("url" , ctx . Value ( urlKey ).( string )), slog . String ( " child" , commitInfo [0 ]), slog .Any ("err" , err ))
187+ logger .ErrorContext (ctx , "Failed to decode hash" , slog .String ("child" , commitInfo [0 ]), slog .Any ("err" , err ))
188188 continue
189189 }
190190 childHash = SHA1 (hash )
191191 default :
192192 // No line should be completely empty (doesn't even have a commit hash) so error
193- logger .ErrorContext (ctx , "Invalid commit info" , slog .String ("url" , ctx . Value ( urlKey ).( string )), slog . String ( " line" , line ))
193+ logger .ErrorContext (ctx , "Invalid commit info" , slog .String ("line" , line ))
194194 continue
195195 }
196196
@@ -223,15 +223,15 @@ func (r *Repository) buildCommitGraph(ctx context.Context, cache *pb.RepositoryC
223223 }
224224 }
225225
226- logger .InfoContext (ctx , "Commit graph completed" , slog .String ( "url" , ctx . Value ( urlKey ).( string )), slog . Int ("new_commits" , len (newCommits )), slog .Duration ("duration" , time .Since (start )))
226+ logger .InfoContext (ctx , "Commit graph completed" , slog .Int ("new_commits" , len (newCommits )), slog .Duration ("duration" , time .Since (start )))
227227
228228 return newCommits , nil
229229}
230230
231231// calculatePatchIDs calculates patch IDs only for the specific commits provided.
232232// Commits should be passed in order if possible. Processing linear commits sequentially improves performance slightly (in the 'git show' commands).
233233func (r * Repository ) calculatePatchIDs (ctx context.Context , commits []SHA1 ) error {
234- logger .InfoContext (ctx , "Starting patch ID calculation" , slog . String ( "url" , ctx . Value ( urlKey ).( string )) )
234+ logger .InfoContext (ctx , "Starting patch ID calculation" )
235235 start := time .Now ()
236236
237237 // Number of workers
@@ -261,7 +261,7 @@ func (r *Repository) calculatePatchIDs(ctx context.Context, commits []SHA1) erro
261261 return fmt .Errorf ("failed to calculate patch IDs: %w" , err )
262262 }
263263
264- logger .InfoContext (ctx , "Patch ID calculation completed" , slog .String ( "url" , ctx . Value ( urlKey ).( string )), slog . Int ("commits" , len (commits )), slog .Duration ("duration" , time .Since (start )))
264+ logger .InfoContext (ctx , "Patch ID calculation completed" , slog .Int ("commits" , len (commits )), slog .Duration ("duration" , time .Since (start )))
265265
266266 return nil
267267}
0 commit comments