@@ -17,14 +17,14 @@ namespace duckdb
1717 // Function to get the download code for the Tranco list
1818 std::string GetTrancoDownloadCode (char *date)
1919 {
20- CURL *curl = CreateCurlHandler ();
20+ CURL *curl = CreateCurlHandler (WriteStringCallback );
2121 CURLcode res;
2222 std::string readBuffer;
2323
2424 // Construct the URL for the daily list
2525 std::string url = " https://tranco-list.eu/daily_list?date=" + std::string (date) + " &subdomains=true" ;
2626
27- LogMessage (LogLevel::INFO , " Get Tranco download code for date: " + std::string (date));
27+ LogMessage (LogLevel::LOG_INFO , " Get Tranco download code for date: " + std::string (date));
2828
2929 curl_easy_setopt (curl, CURLOPT_URL, url.c_str ());
3030 curl_easy_setopt (curl, CURLOPT_WRITEDATA, &readBuffer);
@@ -33,20 +33,20 @@ namespace duckdb
3333
3434 if (res != CURLE_OK)
3535 {
36- LogMessage (LogLevel::ERROR , std::string (curl_easy_strerror (res)));
37- LogMessage (LogLevel::CRITICAL , " Failed to fetch Tranco download code." );
36+ LogMessage (LogLevel::LOG_ERROR , std::string (curl_easy_strerror (res)));
37+ LogMessage (LogLevel::LOG_CRITICAL , " Failed to fetch Tranco download code." );
3838 }
3939
4040 // Extract the download code from the URL
4141 std::regex code_regex (R"( Information on the Tranco list with ID ([A-Z0-9]+))" );
4242 std::smatch code_match;
4343 if (std::regex_search (readBuffer, code_match, code_regex) && code_match.size () > 1 )
4444 {
45- LogMessage (LogLevel::INFO , " Tranco download code: " + code_match[1 ].str ());
45+ LogMessage (LogLevel::LOG_INFO , " Tranco download code: " + code_match[1 ].str ());
4646 return code_match[1 ].str ();
4747 }
4848
49- LogMessage (LogLevel::CRITICAL , " Failed to extract Tranco download code." );
49+ LogMessage (LogLevel::LOG_CRITICAL , " Failed to extract Tranco download code." );
5050 }
5151
5252 // Function to download the Tranco list and create a table
@@ -78,16 +78,16 @@ namespace duckdb
7878 // Construct the download URL
7979 std::string download_url = " https://tranco-list.eu/download/" + download_code + " /full" ;
8080
81- LogMessage (LogLevel::INFO , " Download Tranco list: " + download_url);
81+ LogMessage (LogLevel::LOG_INFO , " Download Tranco list: " + download_url);
8282
8383 // Download the CSV file to a temporary file
84- CURL *curl = CreateCurlHandler ();
84+ CURL *curl = CreateCurlHandler (WriteFileCallback );
8585 CURLcode res;
8686 FILE *file = fopen (temp_file.c_str (), " wb" );
8787 if (!file)
8888 {
8989 curl_easy_cleanup (curl);
90- LogMessage (LogLevel::CRITICAL , " Failed to create temporary file for Tranco list." );
90+ LogMessage (LogLevel::LOG_CRITICAL , " Failed to create temporary file for Tranco list." );
9191 }
9292
9393 curl_easy_setopt (curl, CURLOPT_URL, download_url.c_str ());
@@ -99,18 +99,18 @@ namespace duckdb
9999 if (res != CURLE_OK)
100100 {
101101 remove (temp_file.c_str ()); // Clean up the temporary file
102- LogMessage (LogLevel::ERROR , std::string (curl_easy_strerror (res)));
103- LogMessage (LogLevel::CRITICAL , " Failed to download Tranco list. Check logs for details." );
102+ LogMessage (LogLevel::LOG_ERROR , std::string (curl_easy_strerror (res)));
103+ LogMessage (LogLevel::LOG_CRITICAL , " Failed to download Tranco list. Check logs for details." );
104104 }
105105 }
106106
107107 if (!file.good ())
108108 {
109- LogMessage (LogLevel::CRITICAL , " Tranco list `" + temp_file + " ` not found. Download it first using `SELECT update_tranco(true);`" );
109+ LogMessage (LogLevel::LOG_CRITICAL , " Tranco list `" + temp_file + " ` not found. Download it first using `SELECT update_tranco(true);`" );
110110 }
111111
112112 // Parse the CSV data and insert into a table
113- LogMessage (LogLevel::INFO , " Inserting Tranco list into table" );
113+ LogMessage (LogLevel::LOG_INFO , " Inserting Tranco list into table" );
114114
115115 Connection con (db);
116116 string query = " CREATE OR REPLACE TABLE tranco_list AS"
@@ -133,7 +133,7 @@ namespace duckdb
133133
134134 if (result->HasError ())
135135 {
136- LogMessage (LogLevel::CRITICAL , result->GetError ());
136+ LogMessage (LogLevel::LOG_CRITICAL , result->GetError ());
137137 }
138138 }
139139
@@ -162,7 +162,7 @@ namespace duckdb
162162
163163 if (table_exists->RowCount () == 0 )
164164 {
165- LogMessage (LogLevel::CRITICAL , " Tranco table not found. Download it first using `SELECT update_tranco(true);`" );
165+ LogMessage (LogLevel::LOG_CRITICAL , " Tranco table not found. Download it first using `SELECT update_tranco(true);`" );
166166 }
167167
168168 // Extract the input from the arguments
@@ -201,7 +201,7 @@ namespace duckdb
201201
202202 if (table_exists->RowCount () == 0 )
203203 {
204- LogMessage (LogLevel::CRITICAL , " Tranco table not found. Download it first using `SELECT update_tranco(true);`" );
204+ LogMessage (LogLevel::LOG_CRITICAL , " Tranco table not found. Download it first using `SELECT update_tranco(true);`" );
205205 }
206206
207207 // Extract the input from the arguments
0 commit comments