1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Downloader: Add structured logging, fails storing and statistics

* add  forwarding support in downloader

* Raise needed Go version to 1.21+ so slog can be used.

* Introduce validation mode flag (strict, unsafe)

* Add structured logging and place log into the download folder.

* Improve some code comment (bernhardreiter)

* Add counting stats to downloader.
This commit is contained in:
Sascha L. Teichmann 2023-08-28 15:03:01 +02:00 committed by GitHub
parent e0475791ff
commit 5459f10d39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 429 additions and 143 deletions

View file

@ -11,7 +11,7 @@ package main
import (
"context"
"log"
"log/slog"
"os"
"os/signal"
@ -33,7 +33,10 @@ func run(cfg *config, domains []string) error {
if cfg.ForwardURL != "" {
f := newForwarder(cfg)
go f.run()
defer f.close()
defer func() {
f.log()
f.close()
}()
d.forwarder = f
}
@ -47,7 +50,7 @@ func main() {
options.ErrorCheck(cfg.prepare())
if len(domains) == 0 {
log.Println("No domains given.")
slog.Info("No domains given.")
return
}