guac
guac copied to clipboard
Include a more descriptive debugger for the collector and processor
Description of the PR
This PR incorporates a child logging system that records a unique documentHash. Since the documentHash is being added to the child logger, the entire logging path will contain the documentHash, greatly enhancing the comprehensibility of the log entries.
This PR also includes tests for the child logger.
Log Outputs for the Processor
{"level":"info","ts":1712930572.1896873,"caller":"parser/parser.go:80","msg":"parsing document tree with root type: CycloneDX","documentHash":"sha256:d49be087aece91236ed2e464f5c768028b4106f5e9cd572d9b7f8e57e0a11218"}
{"level":"info","ts":1712930572.1907766,"caller":"helpers/bulk.go:38","msg":"assembling Package: 73","documentHash":"sha256:d49be087aece91236ed2e464f5c768028b4106f5e9cd572d9b7f8e57e0a11218"}
{"level":"info","ts":1712930572.1945672,"caller":"helpers/bulk.go:54","msg":"assembling Source: 0","documentHash":"sha256:d49be087aece91236ed2e464f5c768028b4106f5e9cd572d9b7f8e57e0a11218”}
...
Log Outputs for the Collector
{"level":"info","ts":1712931336.685455,"caller":"collector/collector.go:135","msg":"Successfully marshaled document.","documentHash":"sha256:6b9873ca3443dc0080208d3bfa61274026bfd5191f147a943eae442ac4c07b38"}
{"level":"info","ts":1712931336.687148,"caller":"collector/collector.go:142","msg":"Successfully wrote document to blob store.","documentHash":"sha256:6b9873ca3443dc0080208d3bfa61274026bfd5191f147a943eae442ac4c07b38"}
{"level":"info","ts":1712931336.6875935,"caller":"collector/collector.go:148","msg":"Successfully created an event.","documentHash":"sha256:6b9873ca3443dc0080208d3bfa61274026bfd5191f147a943eae442ac4c07b38"}
{"level":"info","ts":1712931336.6876295,"caller":"collector/collector.go:154","msg":"Successfully marshaled document key.","documentHash":"sha256:6b9873ca3443dc0080208d3bfa61274026bfd5191f147a943eae442ac4c07b38"}
{"level":"info","ts":1712931336.6876893,"caller":"collector/collector.go:159","msg":"Successfully published event.","documentHash":"sha256:6b9873ca3443dc0080208d3bfa61274026bfd5191f147a943eae442ac4c07b38"}
{"level":"info","ts":1712931336.6877022,"caller":"collector/collector.go:161","msg":"doc published: file:///testdata/syft-cyclonedx-docker.io-library-docker.latest.json","documentHash":"sha256:6b9873ca3443dc0080208d3bfa61274026bfd5191f147a943eae442ac4c07b38”}
...
PR Checklist
- [ ] All commits have a Developer Certificate of Origin (DCO) -- they are generated using
-sflag togit commit. - [ ] All new changes are covered by tests
- [ ] If GraphQL schema is changed,
make generatehas been run - [ ] If OpenAPI spec is changed,
make generatehas been run - [ ] If
collectsubprotobuf has been changed,make protohas been run - [ ] All CI checks are passing (tests and formatting)
- [ ] All dependent PRs have already been merged