mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Downloader: Remove verbose flag (#464)
* Remove verbose flag from downloader. * Do structured http logging in forwarder, too. * Use structured logging to separate http traffic of downloader from forwarder.
This commit is contained in:
parent
49da14d47f
commit
7cd076d4f8
7 changed files with 166 additions and 78 deletions
33
internal/options/log.go
Normal file
33
internal/options/log.go
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// This file is Free Software under the MIT License
|
||||
// without warranty, see README.md and LICENSES/MIT.txt for details.
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2023 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
|
||||
// Software-Engineering: 2023 Intevation GmbH <https://intevation.de>
|
||||
|
||||
package options
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// LogLevel implements a helper type to be used in configurations.
|
||||
type LogLevel struct{ slog.Level }
|
||||
|
||||
// MarshalFlag implements [flags.Marshaler].
|
||||
func (ll LogLevel) MarshalFlag() (string, error) {
|
||||
t, err := ll.MarshalText()
|
||||
return strings.ToLower(string(t)), err
|
||||
}
|
||||
|
||||
// UnmarshalFlag implements [flags.Unmarshaler].
|
||||
func (ll *LogLevel) UnmarshalFlag(value string) error {
|
||||
var l slog.Level
|
||||
if err := l.UnmarshalText([]byte(value)); err != nil {
|
||||
return err
|
||||
}
|
||||
*ll = LogLevel{Level: l}
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue