aboutsummaryrefslogtreecommitdiff
path: root/catapult/devil/devil/utils/run_tests_helper.py
blob: b161fd74a00848098e638db57b29a16c1340bf14 (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
# 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', 'quiet'])


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, 0),
      handler=None if add_handler else logging.NullHandler())