Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Fix exception traceback logging #30

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions cirruslib/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ def __init__(self, *args, keys=None, **kwargs):

def process(self, msg, kwargs):
if self.keys is not None:
kwargs = {k: self.extra[k] for k in self.keys if k in self.extra}
return (msg, {"extra": kwargs})
else:
return (msg, kwargs)
kwargs['extra'] = {
k: self.extra[k]
for k in self.keys
if k in self.extra
}
return (msg, kwargs)


def get_task_logger(*args, catalog, **kwargs):
_logger = logging.getLogger(*args, **kwargs)
logger = DynamicLoggerAdapter(_logger, catalog, keys=['id', 'stac_version'])
return logger