Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: client/third_party/infra_libs/logs/logs.py

Issue 2708113002: Revert of Add field_specs to all metrics in luci-py (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Utilities for logging. 5 """Utilities for logging.
6 6
7 Example usage: 7 Example usage:
8 8
9 .. code-block:: python 9 .. code-block:: python
10 10
(...skipping 23 matching lines...) Expand all
34 import logging.handlers 34 import logging.handlers
35 import os 35 import os
36 import re 36 import re
37 import socket 37 import socket
38 import sys 38 import sys
39 import tempfile 39 import tempfile
40 import textwrap 40 import textwrap
41 41
42 import pytz 42 import pytz
43 43
44 from infra_libs.ts_mon.common import metrics 44 from infra_libs.ts_mon.common.metrics import CumulativeMetric
45 45
46 log_metric = metrics.CumulativeMetric( 46 log_metric = CumulativeMetric(
47 'proc/log_lines', 47 'proc/log_lines', description="Number of log lines, per severity level.")
48 'Number of log lines, per severity level.',
49 [metrics.StringField('level')])
50 48
51 if sys.platform.startswith('win'): # pragma: no cover 49 if sys.platform.startswith('win'): # pragma: no cover
52 DEFAULT_LOG_DIRECTORIES = os.pathsep.join([ 50 DEFAULT_LOG_DIRECTORIES = os.pathsep.join([
53 'E:\\chrome-infra-logs', 51 'E:\\chrome-infra-logs',
54 'C:\\chrome-infra-logs', 52 'C:\\chrome-infra-logs',
55 ]) 53 ])
56 else: 54 else:
57 DEFAULT_LOG_DIRECTORIES = '/var/log/chrome-infra' 55 DEFAULT_LOG_DIRECTORIES = '/var/log/chrome-infra'
58 56
59 57
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 for level in file_levels: 286 for level in file_levels:
289 add_handler( 287 add_handler(
290 logger, 288 logger,
291 handler=logging.handlers.RotatingFileHandler( 289 handler=logging.handlers.RotatingFileHandler(
292 filename=os.path.join( 290 filename=os.path.join(
293 logs_directory, pattern % logging.getLevelName(level)), 291 logs_directory, pattern % logging.getLevelName(level)),
294 maxBytes=10 * 1024 * 1024, 292 maxBytes=10 * 1024 * 1024,
295 backupCount=10, 293 backupCount=10,
296 delay=True), 294 delay=True),
297 level=level) 295 level=level)
OLDNEW
« no previous file with comments | « client/third_party/infra_libs/httplib2_utils.py ('k') | client/third_party/infra_libs/ts_mon/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698