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

Side by Side Diff: telemetry/telemetry/internal/util/log_stream.py

Issue 2997373002: WIP to improve Telemetry logging
Patch Set: Created 3 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 | « telemetry/telemetry/internal/story_runner.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import cStringIO
6
7
8 _LOG_STREAM = None
9
10
11 def InitiateLogStream():
12 global _LOG_STREAM
13 assert _LOG_STREAM is None, 'Already initialized'
14 _LOG_STREAM = cStringIO.StringIO()
15 return _LOG_STREAM
16
17
18 def TruncateLogStream():
19 if not _LOG_STREAM:
20 return
21 _LOG_STREAM.truncate(0)
22
23
24 def FlushLogStream(outstream):
25 if not _LOG_STREAM:
26 return
27 print >> outstream, _LOG_STREAM.getvalue()
28 TruncateLogStream()
OLDNEW
« no previous file with comments | « telemetry/telemetry/internal/story_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698