Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

update heron-shell download handler logging #3718

Merged
merged 1 commit into from
Sep 30, 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
10 changes: 9 additions & 1 deletion heron/shell/src/python/handlers/downloadhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import os
import logging
import tornado.web
import anticrlf

from heron.shell.src.python import utils

Expand All @@ -34,7 +35,14 @@ class DownloadHandler(tornado.web.RequestHandler):
def get(self, path):
""" get method """

logging.debug("request to download: %s", path)
handler = logging.StreamHandler()
handler.setFormatter(anticrlf.LogFormatter('%(levelname)s:%(name)s:%(message)s'))
logger = logging.getLogger(__name__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we should move this to a class variable so that no need to set the formatter every time.

Maybe not a big deal fro downloader though since downloading doesn't happen very often.

logger.addHandler(handler)
logger.setLevel(logging.DEBUG)

logger.debug("request to download: %s", path)

# If the file is large, we want to abandon downloading
# if user cancels the requests.
# pylint: disable=attribute-defined-outside-init
Expand Down