Bug 1455143 - Use a global logger instance; r=ted
authorGregory Szorc <gps@mozilla.com>
Wed, 18 Apr 2018 15:33:31 -0700
changeset 468153 e6d309fde362cef30e20aba408958cbce3884425
parent 468152 37fec60424380f4a64d2f568d644e26679a2f99f
child 468154 2bbe78c011d3a4631a3a34b47811564463ab66e5
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1455143
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455143 - Use a global logger instance; r=ted MozReview-Commit-ID: 1RyLZBMx6mH
build/checksums.py
--- a/build/checksums.py
+++ b/build/checksums.py
@@ -5,27 +5,27 @@
 
 from __future__ import with_statement
 
 from optparse import OptionParser
 import hashlib
 import logging
 import os
 
+logger = logging.getLogger('checksums.py')
 
 def digest_file(filename, digest, chunk_size=1024):
     '''Produce a checksum for the file specified by 'filename'.  'filename'
     is a string path to a file that is opened and read in this function.  The
     checksum algorithm is specified by 'digest' and is a valid OpenSSL
     algorithm.  If the digest used is not valid or Python's hashlib doesn't
     work, the None object will be returned instead.  The size of blocks
     that this function will read from the file object it opens based on
     'filename' can be specified by 'chunk_size', which defaults to 1K'''
     assert not os.path.isdir(filename), 'this function only works with files'
-    logger = logging.getLogger('checksums.py')
 
     logger.debug('Creating new %s object' % digest)
     h = hashlib.new(digest)
     with open(filename, 'rb') as f:
         while True:
             data = f.read(chunk_size)
             if not data:
                 logger.debug('Finished reading in file')
@@ -47,17 +47,16 @@ def process_files(files, output_filename
     and needs to be a list of valid OpenSSL algorithms.
 
     The output file is written in the format:
         <hash> <algorithm> <filesize> <filepath>
     Example:
         d1fa09a<snip>e4220 sha1 14250744 firefox-4.0b6pre.en-US.mac64.dmg
     '''
 
-    logger = logging.getLogger('checksums.py')
     if os.path.exists(output_filename):
         logger.debug('Overwriting existing checksums file "%s"' %
                      output_filename)
     else:
         logger.debug('Creating a new checksums file "%s"' % output_filename)
     with open(output_filename, 'w+') as output:
         for file in files:
             if os.path.isdir(file):
@@ -122,17 +121,16 @@ def main():
         loglevel = logging.DEBUG
     elif options.quiet:
         loglevel = logging.ERROR
     else:
         loglevel = logging.INFO
 
     # Set up logging
     setup_logging(loglevel)
-    logger = logging.getLogger('checksums.py')
 
     # Validate the digest type to use
     if not options.digests:
         options.digests = ['sha1']
 
     # Validate the files to checksum
     files = []
     for i in args: