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