mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Expose logging as field in AdvisoryFileProcessor to shrink constructor signature.
This commit is contained in:
parent
f8c3741d12
commit
0ad4ed9e36
3 changed files with 4 additions and 8 deletions
|
|
@ -76,8 +76,7 @@ func (w *worker) mirrorInternal() (*csaf.AggregatorCSAFProvider, error) {
|
||||||
w.client,
|
w.client,
|
||||||
w.expr,
|
w.expr,
|
||||||
w.metadataProvider,
|
w.metadataProvider,
|
||||||
base,
|
base)
|
||||||
nil)
|
|
||||||
|
|
||||||
if err := afp.Process(w.mirrorFiles); err != nil {
|
if err := afp.Process(w.mirrorFiles); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,7 @@ func (d *downloader) download(ctx context.Context, domain string) error {
|
||||||
client,
|
client,
|
||||||
d.eval,
|
d.eval,
|
||||||
lpmd.Document,
|
lpmd.Document,
|
||||||
base,
|
base)
|
||||||
nil)
|
|
||||||
|
|
||||||
// Do we need time range based filtering?
|
// Do we need time range based filtering?
|
||||||
if d.cfg.Range != nil {
|
if d.cfg.Range != nil {
|
||||||
|
|
|
||||||
|
|
@ -73,11 +73,11 @@ func (haf HashedAdvisoryFile) SignURL() string { return haf.name(3, ".asc") }
|
||||||
// advisory file names from a given provider metadata.
|
// advisory file names from a given provider metadata.
|
||||||
type AdvisoryFileProcessor struct {
|
type AdvisoryFileProcessor struct {
|
||||||
AgeAccept func(time.Time) bool
|
AgeAccept func(time.Time) bool
|
||||||
|
Log func(format string, args ...any)
|
||||||
client util.Client
|
client util.Client
|
||||||
expr *util.PathEval
|
expr *util.PathEval
|
||||||
doc any
|
doc any
|
||||||
base *url.URL
|
base *url.URL
|
||||||
log func(format string, args ...any)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAdvisoryFileProcessor constructs an filename extractor
|
// NewAdvisoryFileProcessor constructs an filename extractor
|
||||||
|
|
@ -87,14 +87,12 @@ func NewAdvisoryFileProcessor(
|
||||||
expr *util.PathEval,
|
expr *util.PathEval,
|
||||||
doc any,
|
doc any,
|
||||||
base *url.URL,
|
base *url.URL,
|
||||||
log func(format string, args ...any),
|
|
||||||
) *AdvisoryFileProcessor {
|
) *AdvisoryFileProcessor {
|
||||||
return &AdvisoryFileProcessor{
|
return &AdvisoryFileProcessor{
|
||||||
client: client,
|
client: client,
|
||||||
expr: expr,
|
expr: expr,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
base: base,
|
base: base,
|
||||||
log: log,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +111,7 @@ func empty(arr []string) bool {
|
||||||
func (afp *AdvisoryFileProcessor) Process(
|
func (afp *AdvisoryFileProcessor) Process(
|
||||||
fn func(TLPLabel, []AdvisoryFile) error,
|
fn func(TLPLabel, []AdvisoryFile) error,
|
||||||
) error {
|
) error {
|
||||||
lg := afp.log
|
lg := afp.Log
|
||||||
if lg == nil {
|
if lg == nil {
|
||||||
lg = func(format string, args ...any) {
|
lg = func(format string, args ...any) {
|
||||||
log.Printf("AdvisoryFileProcessor.Process: "+format, args...)
|
log.Printf("AdvisoryFileProcessor.Process: "+format, args...)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue