blob: b83d8aa43b2cefca8315ea314d4c7fc352f967a7 [file] [log] [blame]
# Copyright 2010 Google Inc. All Rights Reserved.
"""Helper class for setting up the logging subsystem."""
__author__ = ' (Dale Curtis)'
import logging
import optparse
def InitializeLogging(verbose=False):
"""Configure the global logger for time/date stamping console output."""
logging.basicConfig(format='%(asctime)s - %(levelname)s: %(message)s')
# Enable verbose output if specified.
if verbose:
def AddOptions(parser):
"""Add command line option group for Logging.
Optional method to add helpful command line options to calling programs. Adds
the option value "verbose".
parser: OptionParser instance.
group = optparse.OptionGroup(parser, 'Logging Options')
group.add_option('--verbose', dest='verbose', action='store_true',
help='Enable verbose output. Script is quiet by default.')