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

Fix downloader logging docs and some comments. (#447)

This commit is contained in:
Sascha L. Teichmann 2023-08-29 10:24:02 +02:00 committed by GitHub
parent 5459f10d39
commit 018e0e55f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 30 deletions

View file

@ -77,7 +77,7 @@ type config struct {
ForwardQueue int `long:"forwardqueue" description:"Maximal queue LENGTH before forwarder" value-name:"LENGTH" toml:"forward_queue"` ForwardQueue int `long:"forwardqueue" description:"Maximal queue LENGTH before forwarder" value-name:"LENGTH" toml:"forward_queue"`
ForwardInsecure bool `long:"forwardinsecure" description:"Do not check TLS certificates from forward endpoint" toml:"forward_insecure"` ForwardInsecure bool `long:"forwardinsecure" description:"Do not check TLS certificates from forward endpoint" toml:"forward_insecure"`
LogFile string `long:"logfile" description:"FILE to log download to" value-name:"FILE" toml:"log_file"` LogFile string `long:"logfile" description:"FILE to log downloading to" value-name:"FILE" toml:"log_file"`
//lint:ignore SA5008 We are using choice or than once: debug, info, warn, error //lint:ignore SA5008 We are using choice or than once: debug, info, warn, error
LogLevel logLevel `long:"loglevel" description:"LEVEL of logging details" value-name:"LEVEL" choice:"debug" choice:"info" choice:"warn" choice:"error" toml:"log_level"` LogLevel logLevel `long:"loglevel" description:"LEVEL of logging details" value-name:"LEVEL" choice:"debug" choice:"info" choice:"warn" choice:"error" toml:"log_level"`
@ -173,7 +173,7 @@ func (ll logLevel) slogLevel() slog.Level {
// prepareDirectory ensures that the working directory // prepareDirectory ensures that the working directory
// exists and is setup properly. // exists and is setup properly.
func (cfg *config) prepareDirectory() error { func (cfg *config) prepareDirectory() error {
// If no special given use current working directory. // If not given use current working directory.
if cfg.Directory == "" { if cfg.Directory == "" {
dir, err := os.Getwd() dir, err := os.Getwd()
if err != nil { if err != nil {

View file

@ -130,7 +130,7 @@ func replaceExt(fname, nExt string) string {
return fname[:len(fname)-len(ext)] + nExt return fname[:len(fname)-len(ext)] + nExt
} }
// buildRequest creates an HTTP request suited ti forward the given advisory. // buildRequest creates an HTTP request suited to forward the given advisory.
func (f *forwarder) buildRequest( func (f *forwarder) buildRequest(
filename, doc string, filename, doc string,
status validationStatus, status validationStatus,

View file

@ -50,7 +50,7 @@ func main() {
options.ErrorCheck(cfg.prepare()) options.ErrorCheck(cfg.prepare())
if len(domains) == 0 { if len(domains) == 0 {
slog.Info("No domains given.") slog.Warn("No domains given.")
return return
} }

View file

@ -29,8 +29,10 @@ Application Options:
-m, --validationmode=MODE[strict|unsafe] MODE how strict the validation is (default: strict) -m, --validationmode=MODE[strict|unsafe] MODE how strict the validation is (default: strict)
--forwardurl=URL URL of HTTP endpoint to forward downloads to --forwardurl=URL URL of HTTP endpoint to forward downloads to
--forwardheader= One or more extra HTTP header fields used by forwarding --forwardheader= One or more extra HTTP header fields used by forwarding
--forwardqueue=LENGTH Maximal queue LENGTH before forwarder --forwardqueue=LENGTH Maximal queue LENGTH before forwarder (default: 5)
--forwardinsecure Do not check TLS certificates from forward endpoint --forwardinsecure Do not check TLS certificates from forward endpoint
--logfile=FILE FILE to log downloading to (default: downloader.log)
--loglevel=LEVEL[debug|info|warn|error] LEVEL of logging details (default: info)
-c, --config=TOML-FILE Path to config TOML file -c, --config=TOML-FILE Path to config TOML file
Help Options: Help Options: