Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

Commit

Permalink
Shorten handlers' logging name + change formatter for developer's logs (
Browse files Browse the repository at this point in the history
  • Loading branch information
armenzg committed Jul 1, 2016
1 parent b9a897b commit cccf20f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pulse_actions/handlers/treeherder_add_new_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from mozci.sources import buildjson, buildbot_bridge
from thclient import TreeherderClient

LOG = logging.getLogger(__name__)
LOG = logging.getLogger(__name__.split('.')[-1])
MEMORY_SAVING_MODE = True


Expand Down
2 changes: 1 addition & 1 deletion pulse_actions/handlers/treeherder_push_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from mozci.sources import buildjson
from thclient import TreeherderClient

LOG = logging.getLogger(__name__)
LOG = logging.getLogger(__name__.split('.')[-1])


def ignored(data):
Expand Down
6 changes: 5 additions & 1 deletion pulse_actions/utils/log_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ def start_logging(log_level=logging.INFO):
log_path = os.path.join(gettempdir(), str(uuid4()))
file_handler = logging.FileHandler(log_path)
file_handler.setLevel(log_level)
file_handler.setFormatter(FORMATTER)
# Developers only care about the messages (no asctime or level names)
# The name of the modules are left in case they want to debug pulse_actions
file_handler.setFormatter(logging.Formatter('%(name)20s %(message)s'))

LOG.addHandler(file_handler)
LOG.info("This log was produced by https://github.com/mozilla/pulse_actions "
"in case you want to help us out! :D")
ALL_HANDLERS[log_path] = file_handler
return log_path

Expand Down

0 comments on commit cccf20f

Please sign in to comment.