Skip to content

Commit

Permalink
feat(dswx-s1): logging
Browse files Browse the repository at this point in the history
Refs #787
  • Loading branch information
chrisjrd committed Apr 17, 2024
1 parent b9cd904 commit 8efe6b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions commons/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ def filter(self, record):
logger.addFilter(LogFilter())


class NoLogUtilsFilter(logging.Filter):

"""Filters out large JSON output of HySDS internals. Apply to any logger (typically __main__) or its
handlers."""
def filter(self, record):
if not record.filename == "elasticsearch_utils.py":
return True

return record.funcName != "update_document"


class NoJobUtilsFilter(logging.Filter):

"""Filters out large JSON output of HySDS internals. Apply to the logger named "hysds_commons" or one of its
Expand Down
4 changes: 3 additions & 1 deletion data_subscriber/daac_data_subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from more_itertools import first
from smart_open import open

from commons.logger import NoJobUtilsFilter, NoBaseFilter
from commons.logger import NoJobUtilsFilter, NoBaseFilter, NoLogUtilsFilter
from data_subscriber.asf_cslc_download import AsfDaacCslcDownload
from data_subscriber.asf_rtc_download import AsfDaacRtcDownload
from data_subscriber.asf_slc_download import AsfDaacSlcDownload
Expand Down Expand Up @@ -66,6 +66,8 @@ def configure_logger():

boto3.set_stream_logger(name='botocore.credentials', level=logging.ERROR)

logger.addFilter(NoLogUtilsFilter())


async def run(argv: list[str]):
logger.info(f"{argv=}")
Expand Down

0 comments on commit 8efe6b2

Please sign in to comment.