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:
parent
e0475791ff
commit
5459f10d39
5 changed files with 429 additions and 143 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue