From 91c7b7c3af0dc46e246655b686b8960a9ad7a904 Mon Sep 17 00:00:00 2001 From: Martin Najemi Date: Sun, 7 Jun 2026 03:37:02 +0200 Subject: [PATCH] chore: Prefix BASIC log output with [BASIC] Risk: low --- CHANGELOG.md | 6 +++++ VERSION | 2 +- internal/log/logging.go | 2 +- main.go | 54 ++++++++++++++++++++--------------------- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b5f6a..33d3422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.22.0] - 2026-06-07 + +### Changed +- `LOG_LEVEL=BASIC` output is now prefixed with `[BASIC]` on every line, mirroring the existing `[DEBUG]` prefix. `log.Basicf` now prepends `[BASIC] ` and appends the trailing newline itself (matching `Debugf`), so callers no longer carry their own `\n`. Output is otherwise unchanged. + ## [0.21.3] - 2026-06-07 ### Fixed @@ -307,6 +312,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Multi-stage Docker build - Automated vendor upgrade workflow +[0.22.0]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.21.3...v0.22.0 [0.21.3]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.21.2...v0.21.3 [0.21.2]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.21.1...v0.21.2 [0.21.1]: https://github.com/gooddata/gooddata-goodchanges/compare/v0.21.0...v0.21.1 diff --git a/VERSION b/VERSION index 804b3de..a7f3fc2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.21.3 \ No newline at end of file +0.22.0 \ No newline at end of file diff --git a/internal/log/logging.go b/internal/log/logging.go index a9dc592..296de5b 100644 --- a/internal/log/logging.go +++ b/internal/log/logging.go @@ -10,7 +10,7 @@ var Debug bool func Basicf(format string, args ...interface{}) { if Basic { - fmt.Fprintf(os.Stderr, format, args...) + fmt.Fprintf(os.Stderr, "[BASIC] "+format+"\n", args...) } } diff --git a/main.go b/main.go index 311d376..71b0ffb 100644 --- a/main.go +++ b/main.go @@ -205,11 +205,11 @@ func main() { // Topologically sort: level 0 = lowest-level (no deps on other affected packages) levels := rush.TopologicalSort(projectMap, affectedSet) - log.Basicf("Merge base: %s\n\n", mergeBase) - log.Basicf("Directly changed projects: %d\n", len(changedProjects)) - log.Basicf("Dep-affected projects (lockfile): %d\n", len(depChangedDeps)) - log.Basicf("Total affected projects (incl. transitive dependents): %d\n", len(affectedSet)) - log.Basicf("Processing in %d levels (bottom-up):\n\n", len(levels)) + log.Basicf("Merge base: %s\n", mergeBase) + log.Basicf("Directly changed projects: %d", len(changedProjects)) + log.Basicf("Dep-affected projects (lockfile): %d", len(depChangedDeps)) + log.Basicf("Total affected projects (incl. transitive dependents): %d", len(affectedSet)) + log.Basicf("Processing in %d levels (bottom-up):\n", len(levels)) // Track affected exports per package for cross-package propagation. allUpstreamTaint := make(map[string]map[string]bool) @@ -243,7 +243,7 @@ func main() { } for levelIdx, level := range levels { - log.Basicf("--- Level %d (%d packages) ---\n\n", levelIdx, len(level)) + log.Basicf("--- Level %d (%d packages) ---\n", levelIdx, len(level)) var wg sync.WaitGroup resultsCh := make(chan pkgResult, len(level)) @@ -259,32 +259,32 @@ func main() { changedDeps := depChangedDeps[info.ProjectFolder] isDepAffected := len(changedDeps) > 0 - log.Basicf("=== %s (%s) ===\n", pkgName, info.ProjectFolder) + log.Basicf("=== %s (%s) ===", pkgName, info.ProjectFolder) if directlyChanged && isDepAffected { - log.Basicf(" [directly changed + dep change in lockfile]\n") + log.Basicf(" [directly changed + dep change in lockfile]") } else if directlyChanged { - log.Basicf(" [directly changed]\n") + log.Basicf(" [directly changed]") } else if isDepAffected { - log.Basicf(" [dep change in lockfile]\n") + log.Basicf(" [dep change in lockfile]") } else { - log.Basicf(" [affected via dependencies]\n") + log.Basicf(" [affected via dependencies]") } if !lib { - log.Basicf(" Type: app (not a library) — skipping export analysis\n\n") + log.Basicf(" Type: app (not a library) — skipping export analysis\n") continue } - log.Basicf(" Type: library\n") + log.Basicf(" Type: library") entrypoints := analyzer.FindEntrypoints(info.ProjectFolder, pkg) if len(entrypoints) == 0 { - log.Basicf(" No entrypoints found — skipping\n\n") + log.Basicf(" No entrypoints found — skipping\n") continue } - log.Basicf(" Entrypoints:\n") + log.Basicf(" Entrypoints:") for _, ep := range entrypoints { - log.Basicf(" %s → %s\n", ep.ExportPath, ep.SourceFile) + log.Basicf(" %s → %s", ep.ExportPath, ep.SourceFile) } if isDepAffected { @@ -292,7 +292,7 @@ func main() { for d := range changedDeps { depNames = append(depNames, d) } - log.Basicf(" Changed external deps: %s\n", strings.Join(depNames, ", ")) + log.Basicf(" Changed external deps: %s", strings.Join(depNames, ", ")) } // Global changeDirs: if triggered, enumerate all exports per entrypoint @@ -315,7 +315,7 @@ func main() { } totalExports += len(exports) } - log.Basicf(" Global changeDirs triggered — %d exports tainted across %d entrypoints\n\n", totalExports, len(entrypoints)) + log.Basicf(" Global changeDirs triggered — %d exports tainted across %d entrypoints\n", totalExports, len(entrypoints)) continue } } @@ -355,11 +355,11 @@ func main() { // Merge results into allUpstreamTaint after all goroutines in this level are done for res := range resultsCh { - log.Basicf(" Affected exports for %s:\n", res.pkgName) + log.Basicf(" Affected exports for %s:", res.pkgName) for _, ae := range res.affected { - log.Basicf(" Entrypoint %q:\n", ae.EntrypointPath) + log.Basicf(" Entrypoint %q:", ae.EntrypointPath) for _, name := range ae.ExportNames { - log.Basicf(" - %s\n", name) + log.Basicf(" - %s", name) } specifier := res.pkgName @@ -373,7 +373,7 @@ func main() { allUpstreamTaint[specifier][name] = true } } - log.Basicf("\n") + log.Basicf("") } } @@ -520,15 +520,15 @@ func main() { }) if flagLog { - log.Basicf("Affected e2e packages (%d):\n", len(e2eList)) + log.Basicf("Affected e2e packages (%d):", len(e2eList)) for _, result := range e2eList { if len(result.Detections) > 0 { - log.Basicf(" - %s (fine-grained: %d files)\n", result.Name, len(result.Detections)) + log.Basicf(" - %s (fine-grained: %d files)", result.Name, len(result.Detections)) for _, d := range result.Detections { - log.Basicf(" %s\n", d) + log.Basicf(" %s", d) } } else { - log.Basicf(" - %s\n", result.Name) + log.Basicf(" - %s", result.Name) } } } @@ -569,7 +569,7 @@ func findLockfileAffectedProjects(config *rush.Config, mergeBase string) (map[st if oldLf.Version() != newLf.Version() { versionChanged[subspace] = true - log.Basicf("lockfileVersion changed in subspace %q: %q → %q\n", subspace, oldLf.Version(), newLf.Version()) + log.Basicf("lockfileVersion changed in subspace %q: %q → %q", subspace, oldLf.Version(), newLf.Version()) } affected := lockfile.FindDepChanges(oldLf, newLf, subspace)