Skip to content

Commit e956640

Browse files
committed
thx drew
1 parent 13c7941 commit e956640

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

pyiceberg/catalog/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,7 @@ def delete_files(io: FileIO, files_to_delete: set[str], file_type: str) -> None:
286286
try:
287287
io.delete(file)
288288
except OSError as exc:
289-
logger.warning(msg=f"Failed to delete {file_type} file {file}")
290-
logger.debug(f"Error deleting {file_type} file {file}", exc_info=exc)
289+
logger.warning(f"Failed to delete {file_type} file {file}", exc_info=exc if logger.isEnabledFor(logging.DEBUG) else None)
291290

292291

293292
def delete_data_files(io: FileIO, manifests_to_delete: list[ManifestFile]) -> None:
@@ -307,8 +306,7 @@ def delete_data_files(io: FileIO, manifests_to_delete: list[ManifestFile]) -> No
307306
try:
308307
io.delete(path)
309308
except OSError as exc:
310-
logger.warning(msg=f"Failed to delete data file {path}")
311-
logger.debug(f"Error deleting data file {path}", exc_info=exc)
309+
logger.warning(f"Failed to delete data file {path}", exc_info=exc if logger.isEnabledFor(logging.DEBUG) else None)
312310
deleted_files[path] = True
313311

314312

@@ -322,8 +320,7 @@ def _import_catalog(name: str, catalog_impl: str, properties: Properties) -> Cat
322320
class_ = getattr(module, class_name)
323321
return class_(name, **properties)
324322
except ModuleNotFoundError as exc:
325-
logger.warning(f"Could not initialize Catalog: {catalog_impl}")
326-
logger.debug(f"Failed to load {catalog_impl}", exc_info=exc)
323+
logger.warning(f"Could not initialize Catalog: {catalog_impl}", exc_info=exc if logger.isEnabledFor(logging.DEBUG) else None)
327324
return None
328325

329326

pyiceberg/io/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ def _import_file_io(io_impl: str, properties: Properties) -> FileIO | None:
322322
class_ = getattr(module, class_name)
323323
return class_(properties)
324324
except ModuleNotFoundError as exc:
325-
logger.warning(f"Could not initialize FileIO: {io_impl}")
326-
logger.debug(f"Failed to load {io_impl}", exc_info=exc)
325+
logger.warning(f"Could not initialize FileIO: {io_impl}", exc_info=exc if logger.isEnabledFor(logging.DEBUG) else None)
327326
return None
328327

329328

pyiceberg/table/locations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ def _import_location_provider(
179179
class_ = getattr(module, class_name)
180180
return class_(table_location, table_properties)
181181
except ModuleNotFoundError as exc:
182-
logger.warning(f"Could not initialize LocationProvider: {location_provider_impl}")
183-
logger.debug(f"Failed to load {location_provider_impl}", exc_info=exc)
182+
logger.warning(f"Could not initialize LocationProvider: {location_provider_impl}", exc_info=exc if logger.isEnabledFor(logging.DEBUG) else None)
184183
return None
185184

186185

0 commit comments

Comments
 (0)