Skip to content

Commit

Permalink
Implement log feedback and fix broken CI (goss-org#844)
Browse files Browse the repository at this point in the history
* Implement log feedback and fix broken CI

* Default programatic log level to ERROR (FATAL no longer exists)
  • Loading branch information
aelsabbahy authored Oct 6, 2023
1 parent ed3be13 commit 3a16622
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions goss_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ func (c *GossConfig) Merge(g2 GossConfig) {
}

func mergeType[V any](m map[string]V, t, k string, v V) {
if _, ok := m[k]; ok {
log.Printf("[WARN] Duplicate key detected: '%s: %s'. The value from a later-loaded goss file has overwritten the previous value.", t, k)
}
m[k] = v
if _, ok := m[k]; ok {
log.Printf("[WARN] Duplicate key detected: '%s: %s'. The value from a later-loaded goss file has overwritten the previous value.", t, k)
}
m[k] = v
}


func (c *GossConfig) Resources() []resource.Resource {
var tests []resource.Resource

Expand Down
4 changes: 2 additions & 2 deletions system/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (c *DefCommand) setup() error {
stdoutB := cmd.Stdout.Bytes()
stderrB := cmd.Stderr.Bytes()
id := c.Ctx.Value("id")
logBytes(stdoutB, fmt.Sprintf("Command: %s: stdout: ", id))
logBytes(stderrB, fmt.Sprintf("Command: %s: stderr: ", id))
logBytes(stdoutB, fmt.Sprintf("[Command][%s][stdout] ", id))
logBytes(stderrB, fmt.Sprintf("[Command][%s][stderr] ", id))
c.stdout = bytes.NewReader(stdoutB)
c.stderr = bytes.NewReader(stderrB)

Expand Down
2 changes: 1 addition & 1 deletion system/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ func logBytes(b []byte, prefix string) {
}
lines := bytes.Split(b, []byte("\n"))
for _, l := range lines {
log.Printf("[DEBUG] %s %s", prefix, l)
log.Printf("[DEBUG]%s %s", prefix, l)
}
}
2 changes: 1 addition & 1 deletion util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func NewConfig(opts ...ConfigOption) (rc *Config, err error) {
DisabledResourceTypes: []string{},
ListenAddress: ":8080",
LocalAddress: "",
LogLevel: "FATAL",
LogLevel: "ERROR",
MaxConcurrent: 50,
NoColor: nil,
NoFollowRedirects: false,
Expand Down

0 comments on commit 3a16622

Please sign in to comment.