Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(logs): adjust logging to write to file #93

Merged
merged 7 commits into from
May 9, 2024

Conversation

stormqueen1990
Copy link
Contributor

  • Enable log-writing to file on a per-inventory basis.

Mauren Berti added 3 commits May 7, 2024 10:26
* Enable log-writing to file on a per-inventory basis.

Signed-off-by: Mauren Berti <mauren.berti@chainguard.dev>
Signed-off-by: Mauren Berti <mauren.berti@chainguard.dev>
Signed-off-by: Mauren Berti <mauren.berti@chainguard.dev>
internal/log/log.go Outdated Show resolved Hide resolved
Mauren Berti added 3 commits May 8, 2024 15:47
Signed-off-by: Mauren Berti <mauren.berti@chainguard.dev>
Signed-off-by: Mauren Berti <mauren.berti@chainguard.dev>
Signed-off-by: Mauren Berti <mauren.berti@chainguard.dev>
Signed-off-by: Mauren Berti <mauren.berti@chainguard.dev>
@stormqueen1990 stormqueen1990 marked this pull request as ready for review May 8, 2024 20:20
Copy link
Collaborator

@joshrwolf joshrwolf left a comment

Choose a reason for hiding this comment

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

I think the comment about the encoding ergonomics can be a nit. its just another thing we have to remember when adding new resources but that is rare, and definitely not impactful enough to block this from going in.

thanks for addressing everything else! :shipit:

@stormqueen1990 stormqueen1990 merged commit 2256d76 into chainguard-dev:main May 9, 2024
5 checks passed
@stormqueen1990 stormqueen1990 deleted the chore/more-logs branch May 9, 2024 20:55
joshrwolf added a commit that referenced this pull request May 13, 2024
follow up on #93 

hoist the logger setup to a `ProviderStore.Logger()` function and call
it in the resources _and_ features. sample output is:


```
# enable it
provider "imagetest" {
  log = {
    file = {}
  }
}
```

output looks like (default to jsonl):

```
{"time":"2024-05-13T10:32:28.993396-04:00","level":"INFO","msg":"Waiting for k3s service to be ready","inventory":"jpqra","harness_id":"foo-jpqra","harness_name":"foo"}
{"time":"2024-05-13T10:32:30.558124-04:00","level":"INFO","msg":"testing feature against harness","inventory":"jpqra","feature_id":"13m58","feature_name":"foo","harness_name":"foo-jpqra"}
{"time":"2024-05-13T10:32:30.55817-04:00","level":"INFO","msg":"stepping in k3s sandbox container","inventory":"jpqra","feature_id":"13m58","feature_name":"foo","harness_name":"foo-jpqra","command":"kubectl get po -A"}
{"time":"2024-05-13T10:32:30.717917-04:00","level":"INFO","msg":"finished stepping in k3s sandbox container","inventory":"jpqra","feature_id":"13m58","feature_name":"foo","harness_name":"foo-jpqra","command":"kubectl get po -A","out":"No resources found\n"}
```

also adds a bit more field metadata that may be useful eventually.

this also removes the `random` data source, which isn't being used
(hopefully), and is wrong(!)
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.

2 participants