Skip to content

Commit

Permalink
Use python logging with __name__
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Nov 8, 2021
1 parent 5b91771 commit 68e597e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions python/lsst/verify/bin/dispatchverify.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,22 @@
import getpass
from dateutil import parser as date_parser
from datetime import datetime, timezone
import logging

try:
import git
except ImportError:
# GitPython is not a standard Stack package; skip gracefully if unavailable
git = None

import lsst.log
from lsst.verify import Job
from lsst.verify.metadata.lsstsw import LsstswRepos
from lsst.verify.metadata.eupsmanifest import Manifest
from lsst.verify.metadata.jenkinsci import get_jenkins_env
from lsst.verify.metadata.ldf import get_ldf_env

_LOG = logging.getLogger(__name__)


def build_argparser():
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -201,7 +203,7 @@ def build_argparser():
def main():
"""Entrypoint for the ``dispatch_verify.py`` command line executable.
"""
log = lsst.log.Log.getLogger('verify.bin.dispatchverify.main')
log = _LOG.getChild('main')

parser = build_argparser()
args = parser.parse_args()
Expand Down Expand Up @@ -312,8 +314,7 @@ def insert_extra_package_metadata(job, config):
"""Insert metadata for extra packages ('--package-repos') into
``Job.meta['packages']``.
"""
log = lsst.log.Log.getLogger(
'verify.bin.dispatchverify.insert_extra_package_metadata')
log = _LOG.getChild("insert_extra_package_metadata")

if 'packages' not in job.meta:
job.meta['packages'] = dict()
Expand Down
9 changes: 5 additions & 4 deletions python/lsst/verify/squash.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@


import requests

import lsst.log
import logging

# Version of the SQUASH API this client is compatible with
_API_VERSION = '1.0'
Expand All @@ -45,6 +44,8 @@
# URLs for SQUASH endpoints, cached by `get_endpoint_url()`.
_ENDPOINT_URLS = None

_LOG = logging.getLogger(__name__)


def get_endpoint_url(api_url, api_endpoint, **kwargs):
"""Lookup SQUASH endpoint URL.
Expand Down Expand Up @@ -215,7 +216,7 @@ def post(api_url, api_endpoint, json_doc=None,
response : `requests.Response`
Response object. Obtain JSON content with ``response.json()``.
"""
log = lsst.log.Log.getLogger('verify.squash.post')
log = _LOG.getChild('post')

api_endpoint_url = get_endpoint_url(api_url, api_endpoint)

Expand Down Expand Up @@ -284,7 +285,7 @@ def get(api_url, api_endpoint=None,
response : `requests.Response`
Response object. Obtain JSON content with ``response.json()``.
"""
log = lsst.log.Log.getLogger('verify.squash.get')
log = _LOG.getChild('get')

if api_user is not None and api_password is not None:
auth = (api_user, api_password)
Expand Down

0 comments on commit 68e597e

Please sign in to comment.