Skip to content

Commit a864ec4

Browse files
refactor: downgrade repetitive logging from info to debug
Token refresh, site URL resolution, library ID lookups, and per-file download messages now log at debug level. Only meaningful one-per-action messages (client init, folder scan, download mask) remain at info. Co-Authored-By: Vojta Tuma <vojta.tuma@keboola.com>
1 parent 8cb90b7 commit a864ec4

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/client/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _get_request_tokens(self) -> None:
102102
"""
103103
This is handled using requests to handle compatibility with OneDrive and Sharepoint client.
104104
"""
105-
logging.info(f"Fetching New Access token from {self.auth_url}")
105+
logging.debug(f"Fetching new access token from {self.auth_url}")
106106
request_url = f"{self.auth_url}/oauth2/v2.0/token"
107107
headers = {"Content-Type": "application/x-www-form-urlencoded"}
108108
payload = {
@@ -126,7 +126,7 @@ def _get_request_tokens(self) -> None:
126126
f"Reauthorize the extractor in extractor configuration."
127127
)
128128

129-
logging.info("New Access token fetched.")
129+
logging.debug("New access token fetched.")
130130
self.access_token = token
131131
self._refresh_token = response.json()["refresh_token"]
132132

@@ -187,11 +187,11 @@ def _get_folder_contents_sharepoint(self, folder_path=None, library_name=None):
187187
folder_id = 'root' if folder_path is None or folder_path == '/' else None
188188

189189
if library_name:
190-
logging.info(f"The component will try to fetch files from library {library_name}")
190+
logging.debug(f"Fetching files from library {library_name}")
191191
library_id = self._get_sharepoint_library_id(library_name)
192-
logging.info(f"Library id: {library_id}")
192+
logging.debug(f"Library id: {library_id}")
193193
library_drive_id = self._get_sharepoint_library_drive_id(library_id)
194-
logging.info(f"Library drive id: {library_drive_id}")
194+
logging.debug(f"Library drive id: {library_drive_id}")
195195
if not folder_id:
196196
folder_id = self._get_sharepoint_folder_id_from_path(library_drive_id, folder_path)
197197
folder_path = self._make_library_folder_path(folder_id, library_drive_id)
@@ -278,13 +278,13 @@ def get_site_id_from_url(self, site_url: str):
278278
url = f"https://graph.microsoft.com/v1.0/sites/{hostname}:{server_relative_path}"
279279
headers = {"Authorization": 'Bearer ' + self.access_token}
280280

281-
logging.info(f"Resolving site URL '{site_url}' via Graph API")
281+
logging.debug(f"Resolving site URL '{site_url}' via Graph API")
282282
response = requests.get(url, headers=headers)
283283

284284
if response.status_code == 200:
285285
site = response.json()
286286
site_id = site['id']
287-
logging.info(f"Resolved site ID: {site_id}")
287+
logging.debug(f"Resolved site ID: {site_id}")
288288
return site_id
289289
else:
290290
raise OneDriveClientException(f"Error occurred when fetching site information for '{site_url}': "
@@ -322,7 +322,7 @@ def _download_file_from_onedrive_url(self, url, output_path, filename):
322322
for chunk in r.iter_content(chunk_size=8192):
323323
f.write(chunk)
324324

325-
logging.info(f"File {filename} downloaded.")
325+
logging.debug(f"File {filename} downloaded.")
326326
except OneDriveClientException as e:
327327
raise e
328328

0 commit comments

Comments
 (0)