Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Import alias Import alias Import alias Import alias Import alias Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpAdd Str Str Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad If AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse Pass Assign AttributeStore NameLoad attr NameLoad ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Global identifier If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore Str Raise Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Global identifier If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str orelse Expr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args defaults body Expr Str Global identifier If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str orelse Expr Call AttributeLoad NameLoad attr Str decorator_list
N/A N/A 
<Program Name>
  log.py

<Author>
  Vladimir Diaz <vladimir.v.diaz@gmail.com>

<Started>
  April 4, 2012.  Based on a previous version of this module by Geremy Condra.

<Copyright>
  See LICENSE for licensing information.

<Purpose>
  A central location for all logging-related configuration.  This module should
  be imported once by the main program.  If other modules wish to incorporate
  'tuf' logging, they should do the following:

  import logging
  logger = logging.getLogger('tuf')

  'logging' refers to the module name.  logging.getLogger() is a function of
  the module 'logging'.  logging.getLogger(name) returns a Logger instance
  associated with 'name'.  Calling getLogger(name) will always return the same
  instance.  In this 'log.py' module, we perform the initial setup for the name
  'tuf'.  The 'log.py' module should only be imported once by the main program.
  When any other module does a logging.getLogger('tuf'), it is referring to the
  same 'tuf' instance, and its associated settings, set here in 'log.py'.
  See http://docs.python.org/library/logging.html#logger-objects for more
  information.

  We use multiple handlers to process log messages in various ways and to
  configure each one independently.  Instead of using one single manner of
  processing log messages, we can use two built-in handlers that have already
  been configured for us.  For example, the built-in FileHandler will catch
  log messages and dump them to a file.  If we wanted, we could set this file
  handler to only catch CRITICAL (and greater) messages and save them to a
  file.  Other handlers (e.g., StreamHandler) could handle INFO-level
  (and greater) messages.

  Logging Levels:

    --Level--         --Value--
  logging.CRITICAL        50
  logging.ERROR           40
  logging.WARNING         30
  logging.INFO            20
  logging.DEBUG           10
  logging.NOTSET           0

  The logging module is thread-safe.  Logging to a single file from
  multiple threads in a single process is also thread-safe.  The logging
  module is NOT thread-safe when logging to a single file across multiple
  processes:
  http://docs.python.org/2/library/logging.html#thread-safety
  http://docs.python.org/2/howto/logging-cookbook.html
 __future__ print_function __future__ absolute_import __future__ division __future__ unicode_literals N/A logging N/A time N/A tuf N/A tuf.formats N/A tuf.conf N/A _DEFAULT_LOG_LEVEL N/A logging DEBUG N/A _DEFAULT_CONSOLE_LOG_LEVEL N/A logging INFO N/A _DEFAULT_FILE_LOG_LEVEL N/A logging DEBUG N/A _FORMAT_STRING N/A [%(asctime)s UTC] [%(name)s] [%(levelname)s]  [%(funcName)s:%(lineno)s@%(filename)s]
%(message)s
 N/A N/A N/A logging Formatter converter N/A time gmtime N/A formatter N/A N/A logging Formatter _FORMAT_STRING N/A console_handler None N/A logger N/A N/A logging getLogger tuf N/A N/A N/A logger setLevel _DEFAULT_LOG_LEVEL N/A N/A N/A tuf conf ENABLE_FILE_LOGGING N/A N/A file_handler N/A N/A logging FileHandler N/A N/A tuf conf LOG_FILENAME N/A N/A N/A file_handler setLevel _DEFAULT_FILE_LOG_LEVEL N/A N/A N/A file_handler setFormatter formatter N/A N/A N/A logger addHandler file_handler N/A N/A N/A N/A logging raiseExceptions False ConsoleFilter N/A N/A logging Filter N/A filter N/A N/A self record N/A N/A N/A 
    <Purpose>
      Use Vinay Sajip's recommendation from Python issue #6435 to modify a
      LogRecord object. This is meant to be used with our console handler.

      http://stackoverflow.com/q/6177520
      http://stackoverflow.com/q/5875225
      http://bugs.python.org/issue6435
      http://docs.python.org/2/howto/logging-cookbook.html#filters-contextual
      http://docs.python.org/2/library/logging.html#logrecord-attributes

    <Arguments>
      record:
        A logging.LogRecord object.

    <Exceptions>
      None.

    <Side Effects>
      Replaces the LogRecord exception text attribute.

    <Returns>
      True.
     N/A N/A record exc_info N/A N/A N/A exc_type exc_value exc_traceback N/A record exc_info N/A N/A record exc_text N/A exc_type __name__ N/A True N/A N/A set_log_level N/A N/A log_level N/A _DEFAULT_LOG_LEVEL N/A N/A 
  <Purpose>
    Allow the default log level to be overridden.  If 'log_level' is not
    provided, log level defaults to 'logging.DEBUG'. 

  <Arguments>
    log_level:
      The log level to set for the 'log.py' file handler.
      'log_level' examples: logging.INFO; logging.CRITICAL.
      
  <Exceptions>
    None.

  <Side Effects>
    Overrides the logging level for the 'log.py' file handler.

  <Returns>
    None.
   N/A N/A N/A N/A N/A tuf formats LOGLEVEL_SCHEMA check_match log_level N/A N/A N/A logger setLevel log_level N/A set_filehandler_log_level N/A N/A log_level N/A _DEFAULT_FILE_LOG_LEVEL N/A N/A 
  <Purpose>
    Allow the default file handler log level to be overridden.  If 'log_level'
    is not provided, log level defaults to 'logging.DEBUG'. 

  <Arguments>
    log_level:
      The log level to set for the 'log.py' file handler.
      'log_level' examples: logging.INFO; logging.CRITICAL.
      
  <Exceptions>
    None.

  <Side Effects>
    Overrides the logging level for the 'log.py' file handler.

  <Returns>
    None.
   N/A N/A N/A N/A N/A tuf formats LOGLEVEL_SCHEMA check_match log_level N/A N/A N/A file_handler setLevel log_level N/A set_console_log_level N/A N/A log_level N/A _DEFAULT_CONSOLE_LOG_LEVEL N/A N/A 
  <Purpose>
    Allow the default log level for console messages to be overridden.  If
    'log_level' is not provided, log level defaults to 'logging.INFO'. 

  <Arguments>
    log_level:
      The log level to set for the console handler.
      'log_level' examples: logging.INFO; logging.CRITICAL.
      
  <Exceptions>
    tuf.Error, if the 'log.py' console handler has not been set yet with
    add_console_handler().

  <Side Effects>
    Overrides the logging level for the console handler.

  <Returns>
    None.
   N/A N/A N/A N/A N/A tuf formats LOGLEVEL_SCHEMA check_match log_level N/A console_handler N/A N/A console_handler None N/A N/A N/A N/A console_handler setLevel log_level N/A N/A message The console handler has not been set with add_console_handler(). N/A N/A N/A tuf Error message N/A add_console_handler N/A N/A log_level N/A _DEFAULT_CONSOLE_LOG_LEVEL N/A N/A 
  <Purpose>
    Add a console handler and set its log level to 'log_level'.

  <Arguments>
    log_level:
      The log level to set for the console handler.
      'log_level' examples: logging.INFO; logging.CRITICAL.
      
  <Exceptions>
    None.

  <Side Effects>
    Adds a console handler to the 'log.py' logger and sets its logging level to
    'log_level'.

  <Returns>
    None.
   N/A N/A N/A N/A N/A tuf formats LOGLEVEL_SCHEMA check_match log_level N/A console_handler N/A N/A console_handler N/A N/A console_handler N/A N/A logging StreamHandler N/A console_filter N/A ConsoleFilter N/A console_format_string %(message)s N/A formatter N/A N/A logging Formatter console_format_string N/A N/A N/A console_handler setLevel log_level N/A N/A N/A console_handler setFormatter formatter N/A N/A N/A console_handler addFilter console_filter N/A N/A N/A logger addHandler console_handler N/A N/A N/A logger debug Added a console handler. N/A N/A N/A N/A logger warning We already have a console handler. N/A remove_console_handler N/A N/A N/A N/A N/A 
  <Purpose>
    Remove the console handler from the logger in 'log.py', if previously added.

  <Arguments>
     None.

  <Exceptions>
    None.

  <Side Effects>
    A handler belonging to the console is removed from the 'log.py' logger
    and the console handler is marked as unset.

  <Returns>
    None.
   N/A console_handler N/A console_handler N/A N/A N/A N/A logger removeHandler console_handler N/A console_handler None N/A N/A N/A logger debug Removed a console handler. N/A N/A N/A N/A logger warning We do not have a console handler. N/A