ftl/common/logger.py (18 lines of code) (raw):

# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """This package defines the shared cli args for ftl binaries.""" import logging from ftl.common import constants LEVEL_MAP = { "NOTSET": logging.NOTSET, "DEBUG": logging.DEBUG, "INFO": logging.INFO, "WARNING": logging.WARNING, "ERROR": logging.ERROR, "CRITICAL": logging.CRITICAL, } def setup_logging(args): logging.getLogger().setLevel(LEVEL_MAP[args.verbosity]) logging.basicConfig(format='%(levelname)-8s %(message)s', datefmt='') def preamble(runtime, args): logging.info("FTL version %s-%s" % (runtime, constants.FTL_VERSION)) logging.info("Beginning FTL build for %s" % runtime) for arg in vars(args): logging.info("FTL arg passed: %s %s" % (arg, getattr(args, arg)))