blob: f8816d0bb5b46248a35b6741dafb352a6b6b5dd5 [file] [log] [blame]
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
LOG_FORMAT = ' %(name)s - %(filename)s - %(lineno)d- %(message)s'
def SetupCellularLogging(logger_name, format_string=LOG_FORMAT):
logger_name: The name of the logger. This name can be used across files
to access the same logger.
format_string: The format of the log message this logger prints.
returns: a log object that may be used :
log.debug('Print this at the debug level ')
log = logging.getLogger(logger_name)
ch = logging.StreamHandler()
formatter = logging.Formatter(format_string)
log.handlers = [ch]
log.propagate = False
return log