5
5
import com .endava .cats .http .HttpMethod ;
6
6
import com .endava .cats .model .FuzzingData ;
7
7
import com .endava .cats .openapi .OpenApiUtils ;
8
- import com .endava .cats .util .CatsUtil ;
9
8
import com .endava .cats .util .JsonUtils ;
10
9
import com .endava .cats .util .VersionProvider ;
11
10
import com .google .gson .JsonParser ;
12
11
import io .github .ludovicianul .prettylogger .PrettyLogger ;
13
12
import io .github .ludovicianul .prettylogger .PrettyLoggerFactory ;
13
+ import io .github .ludovicianul .prettylogger .config .level .PrettyLevel ;
14
14
import io .quarkus .arc .Unremovable ;
15
15
import io .swagger .v3 .oas .models .OpenAPI ;
16
16
import io .swagger .v3 .oas .models .PathItem ;
@@ -89,12 +89,14 @@ public GenerateCommand(FuzzingDataFactory fuzzingDataFactory, CatsGlobalContext
89
89
@ Override
90
90
public void run () {
91
91
try {
92
+ if (!debug ) {
93
+ PrettyLogger .enableLevels (PrettyLevel .CONFIG , PrettyLevel .FATAL );
94
+ }
95
+
92
96
OpenAPI openAPI = OpenApiUtils .readOpenApi (contract );
93
97
this .checkOpenAPI (openAPI );
94
98
this .globalContext .init (openAPI , List .of (contentType ), new Properties ());
95
- if (debug ) {
96
- CatsUtil .setCatsLogLevel ("ALL" );
97
- }
99
+
98
100
PathItem pathItem = openAPI .getPaths ().entrySet ()
99
101
.stream ().filter (openApiPath -> openApiPath .getKey ().equalsIgnoreCase (path ))
100
102
.map (Map .Entry ::getValue ).findFirst ().orElseThrow (() -> new IllegalArgumentException ("Provided path does not exist!" ));
@@ -107,7 +109,7 @@ public void run() {
107
109
printResult (filteredBasedOnHttpMethod .stream ().map (FuzzingData ::getPayload ).toList ());
108
110
} catch (IOException | IllegalArgumentException e ) {
109
111
logger .fatal ("Something went wrong while running CATS: {}" , e .toString ());
110
- logger .debug ("Stacktrace" , e );
112
+ logger .debug ("Stacktrace: {} " , e );
111
113
exitCodeDueToErrors = 192 ;
112
114
}
113
115
}
0 commit comments