Compare commits
1 Commits
b5912d0725
...
3b709bc48e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b709bc48e |
@@ -97,7 +97,9 @@ func main() {
|
||||
case "error":
|
||||
lvl = slog.LevelError
|
||||
}
|
||||
logger := slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: lvl}))
|
||||
// Logs are sent to stderr so that stdout can be safely piped.
|
||||
// The review output (fmt.Printf) stays on stdout unchanged.
|
||||
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: lvl}))
|
||||
slog.SetDefault(logger)
|
||||
|
||||
// Backwards compatibility: map deprecated flag values (if any) to the embedded ReviewConfig.
|
||||
|
||||
@@ -69,13 +69,11 @@ func (s *Service) MakeReview(ctx context.Context, organisation string, repo stri
|
||||
for _, c := range comments {
|
||||
c.Message = fmt.Sprintf("%s (Generated by: %s)", c.Message, model)
|
||||
|
||||
if s.disableComments {
|
||||
// Dry‑run: just log what would have been posted.
|
||||
log.Printf("dry‑run: %s:%d => %s", c.File, c.Line, c.Message)
|
||||
} else {
|
||||
// Normal mode: print to stdout and post the comment to the VCS.
|
||||
fmt.Printf("File: %s\nLine: %d\nMessage: %s\n%s\n",
|
||||
c.File, c.Line, c.Message, "---")
|
||||
|
||||
if s.disableComments {
|
||||
if err := s.git.AddComment(ctx, organisation, repo, prID, c); err != nil {
|
||||
log.Printf("Failed to add comment: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user