Bug 457825 - Support access control headers when downloading fonts. r=jonas,dbaron...
[wine-gecko.git] / testing / release / minotaur / logAppender.py
blobd716a5c48b385f308ae374d6e6dace05355128ef
1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
12 # License.
14 # The Original Code is Mozilla Corporation Code.
16 # The Initial Developer of the Original Code is
17 # Clint Talbert.
18 # Portions created by the Initial Developer are Copyright (C) 2007
19 # the Initial Developer. All Rights Reserved.
21 # Contributor(s):
22 # Clint Talbert <ctalbert@mozilla.com>
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK *****
38 # Class to append data to a text file. It also provides a method to handle
39 # information going to stderr. To use the stderr redirect, make this call after
40 # you instantiate LogAppender:
41 # import sys
42 # sys.stderr=stderrCatcher(<logFileAppenderObject>)
44 class stderrCatcher:
45 def __init__(self, logappender=0):
46 self.lf = logappender
47 def write(self, stuff):
48 if self.lf:
49 self.lf.onStdError(stuff)
51 class LogAppender:
52 def __init__(self, file):
53 self.logFile = open(file, "a")
54 def onStdError(self, str):
55 self.logFile.write("STDERR:" + str + "\n")
56 def writeLog(self, str):
57 self.logFile.write(str + "\n")
58 return str
59 def writelines(self, str):
60 self.logFile.writelines(str)
61 self.logFile.write("\n")
62 def closeFile(self):
63 self.logFile.write("\n---Normal Close---\n")