@@ -6,12 +6,15 @@ import (
6
6
"time"
7
7
8
8
"github.com/projectdiscovery/fastdialer/fastdialer"
9
+ "github.com/projectdiscovery/gologger"
10
+ "github.com/projectdiscovery/gologger/levels"
9
11
"github.com/projectdiscovery/katana/pkg/output"
10
12
"github.com/projectdiscovery/katana/pkg/utils/extensions"
11
13
"github.com/projectdiscovery/katana/pkg/utils/filters"
12
14
"github.com/projectdiscovery/katana/pkg/utils/scope"
13
15
"github.com/projectdiscovery/ratelimit"
14
16
errorutil "github.com/projectdiscovery/utils/errors"
17
+ logutil "github.com/projectdiscovery/utils/log"
15
18
urlutil "github.com/projectdiscovery/utils/url"
16
19
wappalyzer "github.com/projectdiscovery/wappalyzergo"
17
20
)
@@ -39,6 +42,7 @@ type CrawlerOptions struct {
39
42
// NewCrawlerOptions creates a new crawler options structure
40
43
// from user specified options.
41
44
func NewCrawlerOptions (options * Options ) (* CrawlerOptions , error ) {
45
+ configureOutput (options )
42
46
extensionsValidator := extensions .NewValidator (options .ExtensionsMatch , options .ExtensionFilter )
43
47
44
48
dialerOpts := fastdialer .DefaultOptions
@@ -147,3 +151,18 @@ func (c *CrawlerOptions) ValidateScope(absURL, rootHostname string) (bool, error
147
151
}
148
152
return true , nil
149
153
}
154
+
155
+ // configureOutput configures the output logging levels to be displayed on the screen
156
+ func configureOutput (options * Options ) {
157
+ if options .Silent {
158
+ gologger .DefaultLogger .SetMaxLevel (levels .LevelSilent )
159
+ } else if options .Verbose {
160
+ gologger .DefaultLogger .SetMaxLevel (levels .LevelWarning )
161
+ } else if options .Debug {
162
+ gologger .DefaultLogger .SetMaxLevel (levels .LevelDebug )
163
+ } else {
164
+ gologger .DefaultLogger .SetMaxLevel (levels .LevelInfo )
165
+ }
166
+
167
+ logutil .DisableDefaultLogger ()
168
+ }
0 commit comments