16
16
#include " swift/extractor/invocation/SwiftInvocationExtractor.h"
17
17
#include " swift/extractor/trap/TrapDomain.h"
18
18
#include " swift/extractor/infra/file/Path.h"
19
+ #include " swift/extractor/infra/log/SwiftLogging.h"
19
20
20
21
using namespace std ::string_literals;
21
22
@@ -179,7 +180,27 @@ codeql::SwiftExtractorConfiguration configure(int argc, char** argv) {
179
180
return configuration;
180
181
}
181
182
182
- int main (int argc, char ** argv) {
183
+ static auto argDump (int argc, char ** argv) {
184
+ std::string ret;
185
+ for (auto arg = argv + 1 ; arg < argv + argc; ++arg) {
186
+ ret += *arg;
187
+ ret += ' ' ;
188
+ }
189
+ ret.pop_back ();
190
+ return ret;
191
+ }
192
+
193
+ static auto envDump (char ** envp) {
194
+ std::string ret;
195
+ for (auto env = envp; *env; ++env) {
196
+ ret += *env;
197
+ ret += ' \n ' ;
198
+ }
199
+ ret.pop_back ();
200
+ return ret;
201
+ }
202
+
203
+ int main (int argc, char ** argv, char ** envp) {
183
204
checkWhetherToRunUnderTool (argc, argv);
184
205
185
206
if (argc == 1 ) {
@@ -193,6 +214,10 @@ int main(int argc, char** argv) {
193
214
initializeSwiftModules ();
194
215
195
216
const auto configuration = configure (argc, argv);
217
+ codeql::Log::configure (" extractor" );
218
+ auto & logger = codeql::logger ();
219
+ LOG_INFO (" calling extractor with arguments \" {}\" " , argDump (argc, argv));
220
+ LOG_DEBUG (" environment:\n {}\n " , envDump (envp));
196
221
197
222
auto openInterception = codeql::setupFileInterception (configuration);
198
223
@@ -204,5 +229,7 @@ int main(int argc, char** argv) {
204
229
observer.markSuccessfullyExtractedFiles ();
205
230
}
206
231
232
+ codeql::Log::flush ();
233
+
207
234
return frontend_rc;
208
235
}
0 commit comments