Skip to content

Provide more logs#41

Open
Vladyslav-Kuksiuk wants to merge 4 commits into
improve-tests-embebbingfrom
add-logs
Open

Provide more logs#41
Vladyslav-Kuksiuk wants to merge 4 commits into
improve-tests-embebbingfrom
add-logs

Conversation

@Vladyslav-Kuksiuk
Copy link
Copy Markdown
Collaborator

This PR adds more logs throughout the embedding process.

These info logs are displayed only when the application is launched with the --info argument.

Logs example:
image

Partly resolves this issue.

Copy link
Copy Markdown
Collaborator

@dmytro-kashcheiev dmytro-kashcheiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR increases observability of the embed/check workflow by adding new info-level log statements across CLI/config loading, document selection, embedding processing, and fragment extraction, and introduces a helper for producing “clickable” file references in logs.

Changes:

  • Add new slog.Info messages across CLI, embedding, parsing, and fragmentation to describe progress and skip reasons.
  • Introduce logging.FileReference() and adopt it in multiple log messages.
  • Fix propagation of doc-excludes from command-line args into the runtime configuration (with a new test).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
main.go Adds startup log and helper formatting for config labels.
logging/logger.go Adds FileReference() helper for log-friendly file URLs.
fragmentation/resolver.go Adds info logs for missing source files/fragments and uses file references in messages.
embedding/processor.go Adds detailed processing/checking logs and logs include/exclude pattern resolution.
embedding/parsing/instruction.go Adds logs describing what content an instruction extracted (fragment/pattern/full file).
cli/cli.go Adds logs for config loading and setup selection; propagates DocExcludes into runtime config.
cli/cli_test.go Adds test ensuring command-line doc-excludes is copied into runtime configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread logging/logger.go
Comment on lines +90 to +98
// FileReference returns a clickable file URL when the path can be made absolute.
func FileReference(path string) string {
absPath, err := filepath.Abs(path)
if err != nil {
return path
}

return "file://" + absPath
}
Comment thread fragmentation/resolver.go
@@ -66,13 +72,24 @@ func ResolveContent(codePath string, fragmentName string, config config.Configur
fragment, found := content.fragments[fragmentName]
if !found {
codeFileReference := "file://" + source.absolutePath
Comment thread embedding/processor.go
Comment on lines 94 to 99
func (p Processor) Embed() (*parsing.Context, error) {
if !slices.Contains(p.requiredDocPaths, p.DocFilePath) {
slog.Info(fmt.Sprintf("Skipping `%s`; it is excluded by the configuration.",
logging.FileReference(p.DocFilePath)))
return nil, nil
}
Comment thread main.go
Comment on lines +137 to +145
// configNameLabel formats a configuration name for human-readable log messages.
func configNameLabel(config configuration.Configuration) string {
if config.Name == "" {
return ""
}

return fmt.Sprintf(" for `%s`", config.Name)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants