summaryrefslogtreecommitdiff
path: root/systrace/catapult/devil/devil/utils/run_tests_helper.py
blob: 7f71b65cb4deedc6f4195166a4f69a93710109b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Helper functions common to native, java and host-driven test runners."""

import collections
import logging

from devil.utils import logging_common


CustomFormatter = logging_common.CustomFormatter


_WrappedLoggingArgs = collections.namedtuple(
    '_WrappedLoggingArgs', ['verbose'])


def SetLogLevel(verbose_count, add_handler=True):
  """Sets log level as |verbose_count|.

  Args:
    verbose_count: Verbosity level.
    add_handler: If true, adds a handler with |CustomFormatter|.
  """
  logging_common.InitializeLogging(
      _WrappedLoggingArgs(verbose_count),
      handler=None if add_handler else logging.NullHandler())