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

Side by Side Diff: third_party/chrome/ppapi/generators/idl_log.py

Issue 12300042: Update idlsync.py to pull in dependencies required for chrome api generation. (Closed) Base URL: git://github.com/dart-lang/bleeding_edge.git@master
Patch Set: From another checkout Created 7 years, 9 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
(Empty)
1 # Copyright (c) 2012 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 """ Error and information logging for IDL """
6
7 #
8 # IDL Log
9 #
10 # And IDLLog object provides a mechanism for capturing logging output
11 # and/or sending out via a file handle (usually stdout or stderr).
12 #
13 import sys
14
15
16 class IDLLog(object):
17 def __init__(self, name, out):
18 if name:
19 self.name = '%s : ' % name
20 else:
21 self.name = ''
22
23 self.out = out
24 self.capture = False
25 self.console = True
26 self.log = []
27
28 def Log(self, msg):
29 line = "%s\n" % (msg)
30 if self.console: self.out.write(line)
31 if self.capture:
32 self.log.append(msg)
33
34 def LogTag(self, msg):
35 line = "%s%s\n" % (self.name, msg)
36 if self.console: self.out.write(line)
37 if self.capture:
38 self.log.append(msg)
39
40 def LogLine(self, filename, lineno, pos, msg):
41 line = "%s(%d) : %s%s\n" % (filename, lineno, self.name, msg)
42 if self.console: self.out.write(line)
43 if self.capture: self.log.append(msg)
44
45 def SetConsole(self, enable, out = None):
46 self.console = enable
47 if out: self.out = out
48
49 def SetCapture(self, enable):
50 self.capture = enable
51
52 def DrainLog(self):
53 out = self.log
54 self.log = []
55 return out
56
57 ErrOut = IDLLog('Error', sys.stderr)
58 WarnOut = IDLLog('Warning', sys.stdout)
59 InfoOut = IDLLog('', sys.stdout)
OLDNEW
« no previous file with comments | « third_party/chrome/ppapi/generators/idl_lint.py ('k') | third_party/chrome/ppapi/generators/idl_namespace.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698