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

Side by Side Diff: client/utils/logging_utils.py

Issue 1373133004: Fixes and add smoke test: hard timeout on isolated task. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: . Created 5 years, 2 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 | « appengine/swarming/tools/start_servers.py ('k') | client/utils/subprocess42.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 2015 The Swarming Authors. All rights reserved. 1 # Copyright 2015 The Swarming Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 that 2 # Use of this source code is governed under the Apache License, Version 2.0 that
3 # can be found in the LICENSE file. 3 # can be found in the LICENSE file.
4 4
5 """Utility relating to logging.""" 5 """Utility relating to logging."""
6 6
7 import argparse 7 import argparse
8 import codecs 8 import codecs
9 import ctypes 9 import ctypes
10 import logging 10 import logging
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 def formatTime(self, record, datefmt=None): 146 def formatTime(self, record, datefmt=None):
147 """Change is ',' to '.'.""" 147 """Change is ',' to '.'."""
148 ct = self.converter(record.created) 148 ct = self.converter(record.created)
149 if datefmt: 149 if datefmt:
150 return time.strftime(datefmt, ct) 150 return time.strftime(datefmt, ct)
151 else: 151 else:
152 t = time.strftime("%Y-%m-%d %H:%M:%S", ct) 152 t = time.strftime("%Y-%m-%d %H:%M:%S", ct)
153 return "%s.%03d" % (t, record.msecs) 153 return "%s.%03d" % (t, record.msecs)
154 154
155 155
156 class Filter(logging.Filter): 156 class Filter(object):
157 """Adds fields used by the infra-specific formatter. 157 """Adds fields used by the infra-specific formatter.
158 158
159 Fields added: 159 Fields added:
160 - 'severity': one-letter indicator of log level (first letter of levelname). 160 - 'severity': one-letter indicator of log level (first letter of levelname).
161 """ 161 """
162 162
163 def filter(self, record): 163 def filter(self, record):
164 record.severity = record.levelname[0] 164 record.severity = record.levelname[0]
165 return True 165 return True
166 166
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 def parse_args(self, *args, **kwargs): 292 def parse_args(self, *args, **kwargs):
293 # Make sure this group is always the last one. 293 # Make sure this group is always the last one.
294 self._add_logging_group() 294 self._add_logging_group()
295 295
296 args = super(ArgumentParserWithLogging, self).parse_args(*args, **kwargs) 296 args = super(ArgumentParserWithLogging, self).parse_args(*args, **kwargs)
297 prepare_logging(self.enable_log_file and args.log_file, self.logger_root) 297 prepare_logging(self.enable_log_file and args.log_file, self.logger_root)
298 set_console_level( 298 set_console_level(
299 LEVELS[min(len(LEVELS) - 1, args.verbose)], self.logger_root) 299 LEVELS[min(len(LEVELS) - 1, args.verbose)], self.logger_root)
300 return args 300 return args
OLDNEW
« no previous file with comments | « appengine/swarming/tools/start_servers.py ('k') | client/utils/subprocess42.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698