1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 __authors__ = ["Olof Svensson", "Jerome Kieffer"]
34 __contact__ = "svensson@esrf.fr"
35 __license__ = "LGPLv3+"
36 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
37
38
39 from EDObject import EDObject
40 from EDLoggingVerbose import EDLoggingVerbose
41 from EDLoggingPyLogging import EDLoggingPyLogging
42
43
45 """
46 This class loads one of the EDNA loggers: EDLoggingVerbose, EDLoggingClass
47 """
48
49
50 - def __init__(self, _strLoggerName="EDVerbose"):
56
57
60
61
64
65
67 """
68 turn on the test mode: all assertions become verbose (->screen)
69 """
70 self.edLogging.setTestOn()
71
72
74 """
75 turn off the test mode: all assertions become silent (->screen)
76 """
77 self.edLogging.setTestOff()
78
79
81 """
82 This method turns on verbose logging to standard output (stdout)
83 """
84 self.edLogging.setVerboseOn()
85
86
88 """
89 This method turns off verbose logging to standard output (stdout)
90 """
91 self.edLogging.setVerboseOff()
92
93
95 """
96 This method turns on debug messages to standard output and log file
97 """
98 self.edLogging.setVerboseDebugOn()
99
100
102 """
103 This method turns off debug messages to standard output and log file
104 """
105 self.edLogging.setVerboseDebugOff()
106
107
109 """
110 This method returns the current status of debugging
111
112 @return: if debug output to standard output and log file is enabled.
113 @type: boolean
114 """
115 return self.edLogging.isVerboseDebug()
116
117
118 - def log(self, _strMessage=""):
119 """
120 This method writes a message only to the log file.
121
122 @param _strMessage: The string to be written to the log file
123 @type _strMessage: python string
124 """
125 self.edLogging.log(_strMessage)
126
127 - def screen(self, _strMessage=""):
128 """
129 This method writes a message to standard output and to the log file.
130
131 @param _strMessage: The string to be written to the log file
132 @type _strMessage: python string
133 """
134 self.edLogging.screen(_strMessage)
135
136
137 - def DEBUG(self, _strDebugMessage=""):
138 """
139 This method writes a debug message to standard output and to the log file
140 if debugging is enabled. The message will be written with the prefix [DEBUG]
141
142 @param _strDebugMessage: The debug message to be written to standard output and log file
143 @type _strDebugMessage: python string
144 """
145 self.edLogging.DEBUG(_strDebugMessage)
146
147
149 """
150 This method is meant to be used by the testing framework. The message will be written
151 to standard output and the log file with the prefix [UnitTest]
152
153 @param _strMessage: The message to be written to standard output and log file
154 @type _strMessage: python string
155 """
156 self.edLogging.unitTest(_strMessage)
157
158
159 - def ERROR(self, _strMessage=""):
160 """
161 This method writes a message to standard error and the log file with the prefix [ERROR].
162
163 @param _strMessage: The error message to be written to standard output and log file
164 @type _strMessage: python string
165 """
166 self.edLogging.ERROR(_strMessage)
167
168
169 - def error(self, _strMessage=""):
170 """
171 This method writes a message to standard error and the log file with the prefix [ERROR].
172
173 @param _strMessage: The error message to be written to standard output and log file
174 @type _strMessage: python string
175 """
176 self.edLogging.error(_strMessage)
177
178
179 - def WARNING(self, _strMessage=""):
180 """
181 This method writes a warning message to standard output and the log file with the prefix [Warning].
182
183 @param _strMessage: The error message to be written to standard output and log file
184 @type _strMessage: python string
185 """
186 self.edLogging.WARNING(_strMessage)
187
188
189
190 - def warning(self, _strMessage=""):
191 """
192 This method writes a warning message to standard output and the log file with the prefix [Warning].
193
194 @param _strMessage: The error message to be written to standard output and log file
195 @type _strMessage: python string
196 """
197 self.edLogging.warning(_strMessage)
198
199
200 - def ASSERT(self, _strMessage):
201 """
202 This method writes an assert message to standard output and the log file with the prefix [ASSERT].
203
204 @param _strMessage: The error message to be written to standard output and log file
205 @type _strMessage: python string
206 """
207 self.edLogging.ASSERT(_strMessage)
208
210 """
211 This method writes an error trace to standard output and the log file. The error trace has
212 the same formatting as normal Python error traces.
213
214 @param _strPrefix: A prefix which can be customized, e.g. the testing framework uses ' [UnitTest]'
215 @type _strPrefix: python string
216 """
217 self.edLogging.writeErrorTrace(_strPrefix)
218
219
221 """
222 This method can be used for customising the file name of the log file.
223
224 @param _strLogFileName: A file name for the log file.
225 @type _strLogFileName: python string
226 """
227 self.edLogging.setLogFileName(_strLogFileName)
228
229
231 """
232 This method truns off output to the log file.
233 """
234 self.edLogging.setLogFileOff()
235