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

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

Issue 1260293009: make version of ts_mon compatible with appengine (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: add noncululativedistribution metric to ts_mon imports Created 5 years, 4 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
« no previous file with comments | « infra_libs/instrumented_requests.py ('k') | infra_libs/test/httplib2_utils_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import metrics 44 from infra_libs.ts_mon.common.metrics import CumulativeMetric
45 45
46 log_metric = metrics.CumulativeMetric('proc/log_lines') 46 log_metric = CumulativeMetric('proc/log_lines')
47 47
48 if sys.platform.startswith('win'): # pragma: no cover 48 if sys.platform.startswith('win'): # pragma: no cover
49 DEFAULT_LOG_DIRECTORIES = os.pathsep.join([ 49 DEFAULT_LOG_DIRECTORIES = os.pathsep.join([
50 'E:\\chrome-infra-logs', 50 'E:\\chrome-infra-logs',
51 'C:\\chrome-infra-logs', 51 'C:\\chrome-infra-logs',
52 ]) 52 ])
53 else: 53 else:
54 DEFAULT_LOG_DIRECTORIES = '/var/log/chrome-infra' 54 DEFAULT_LOG_DIRECTORIES = '/var/log/chrome-infra'
55 55
56 56
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 for level in (logging.INFO, logging.WARNING, logging.ERROR): 265 for level in (logging.INFO, logging.WARNING, logging.ERROR):
266 add_handler( 266 add_handler(
267 logger, 267 logger,
268 handler=logging.handlers.RotatingFileHandler( 268 handler=logging.handlers.RotatingFileHandler(
269 filename=os.path.join( 269 filename=os.path.join(
270 logs_directory, pattern % logging.getLevelName(level)), 270 logs_directory, pattern % logging.getLevelName(level)),
271 maxBytes=10 * 1024 * 1024, 271 maxBytes=10 * 1024 * 1024,
272 backupCount=10, 272 backupCount=10,
273 delay=True), 273 delay=True),
274 level=level) 274 level=level)
OLDNEW
« no previous file with comments | « infra_libs/instrumented_requests.py ('k') | infra_libs/test/httplib2_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698