OpenKeyWord  Version: 426, Datum:
Logger.cs
1 #region Header
2 /*
3  ==============================================================================
4  Author: Zoltan Hrabovszki <zh@openkeyword.de>
5 
6  Copyright © 2012, 2013, 2014, 2015 IT-Beratung Hrabovszki
7  www.OpenKeyWord.de
8  ==============================================================================
9 
10  This file is part of OpenKeyWord.
11 
12  OpenKeyWord is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  OpenKeyWord is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with OpenKeyWord. If not, see <http://www.gnu.org/licenses/>.
24 
25  Diese Datei ist Teil von OpenKeyWord.
26 
27  OpenKeyWord ist Freie Software: Sie können es unter den Bedingungen
28  der GNU General Public License, wie von der Free Software Foundation,
29  Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
30  veröffentlichten Version, weiterverbreiten und/oder modifizieren.
31 
32  OpenKeyWord wird in der Hoffnung, dass es nützlich sein wird, aber
33  OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
34  Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
35  Siehe die GNU General Public License für weitere Details.
36 
37  Sie sollten eine Kopie der GNU General Public License zusammen mit
38  OpenKeyWord erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
39 */
40 #endregion Header
41 
42 namespace OKW.Log
43 {
44  using System;
45  using System.Collections.Generic;
46 
47  public class Logger
48  {
49  #region Fields
50 
51  private static readonly Logger instance = new Logger();
52 
53  private bool cvbDebugMode = false;
54  private List<ILogger> LoggerList = new List<ILogger>();
55 
56  #endregion Fields
57 
58  #region Constructors
59 
60  private Logger()
61  {
62  }
63 
64  #endregion Constructors
65 
66  #region Properties
67 
68  public static Logger Instance
69  {
70  get
71  {
72  return instance;
73  }
74  }
75 
76  public bool DebugMode
77  {
78  get
79  {
80  return this.cvbDebugMode;
81  }
82 
83  set
84  {
85  this.cvbDebugMode = value;
86  }
87  }
88 
89  #endregion Properties
90 
91  #region Methods
92 
110  public void AddLogger(ILogger fpLogger)
111  {
112  this.LoggerList.Add(fpLogger);
113  }
114 
131  public void Init()
132  {
133  this.LoggerList.Clear();
134  this.cvbDebugMode = false;
135  }
136 
142  public void LogError(string fps_Message)
143  {
144  foreach (ILogger myLogger in this.LoggerList)
145  {
146  myLogger.LogError(fps_Message);
147  }
148  }
149 
155  public void LogException(string fps_Message)
156  {
157  foreach (ILogger myLogger in this.LoggerList)
158  {
159  myLogger.LogException(fps_Message);
160  }
161  }
162 
163  public void LogFunctionEnd(string fps_Return)
164  {
165  foreach (ILogger myLogger in this.LoggerList)
166  {
167  myLogger.LogFunctionEnd(fps_Return);
168  }
169  }
170 
171  public void LogFunctionEnd(bool fpb_Return)
172  {
173  foreach (ILogger myLogger in this.LoggerList)
174  {
175  myLogger.LogFunctionEnd(fpb_Return);
176  }
177  }
178 
179  public void LogFunctionEnd(List<string> fpls_Return)
180  {
181  foreach (ILogger myLogger in this.LoggerList)
182  {
183  myLogger.LogFunctionEnd(fpls_Return);
184  }
185  }
186 
187  public void LogFunctionEnd()
188  {
189  foreach (ILogger myLogger in this.LoggerList)
190  {
191  myLogger.LogFunctionEnd();
192  }
193  }
194 
195  public void LogFunctionEndDebug()
196  {
197  if (this.cvbDebugMode)
198  {
199  foreach (ILogger myLogger in this.LoggerList)
200  {
201  myLogger.LogFunctionEnd();
202  }
203  }
204  }
205 
206  public void LogFunctionEndDebug(string fps_Return)
207  {
208  if (this.cvbDebugMode)
209  {
210  foreach (ILogger myLogger in this.LoggerList)
211  {
212  myLogger.LogFunctionEnd(fps_Return);
213  }
214  }
215  }
216 
217  public void LogFunctionEndDebug(List<string> fps_Return)
218  {
219  if (this.cvbDebugMode)
220  {
221  foreach (ILogger myLogger in this.LoggerList)
222  {
223  myLogger.LogFunctionEnd(fps_Return);
224  }
225  }
226  }
227 
228  public void LogFunctionEndDebug(bool fpb_Return)
229  {
230  if (this.cvbDebugMode)
231  {
232  foreach (ILogger myLogger in this.LoggerList)
233  {
234  myLogger.LogFunctionEnd(fpb_Return);
235  }
236  }
237  }
238 
239 
240  public void LogFunctionStart(string fps_FunctionName, params string[] fpsParameter)
241  {
242  foreach (ILogger myLogger in this.LoggerList)
243  {
244  myLogger.LogFunctionStart(fps_FunctionName, fpsParameter);
245  }
246  }
247 
248 
249  public void LogFunctionStartDebug(string fps_FunctionName, params string[] fpsParameter)
250  {
251  if (this.cvbDebugMode)
252  {
253  foreach (ILogger myLogger in this.LoggerList)
254  {
255  myLogger.LogFunctionStart(fps_FunctionName, fpsParameter);
256  }
257  }
258  }
259 
260 
261  public void LogKeyWordEnd()
262  {
263  foreach (ILogger myLogger in this.LoggerList)
264  {
265  myLogger.LogKeyWordEnd();
266  }
267  }
268 
269 
289  public void LogKeyWordStart(string fpsKeyWordName, params string[] fpsParameter)
290  {
291  foreach (ILogger myLogger in this.LoggerList)
292  {
293  myLogger.LogKeyWordStart(fpsKeyWordName, fpsParameter);
294  }
295  }
296 
302  public void LogPrint(string fps_Message)
303  {
304  foreach (ILogger myLogger in this.LoggerList)
305  {
306  myLogger.LogPrint(fps_Message);
307  }
308  }
309 
332  public void LogPrintDebug(string fpsMessage)
333  {
334  if (this.cvbDebugMode)
335  {
336  foreach (ILogger myLogger in this.LoggerList)
337  {
338  myLogger.LogPrint(fpsMessage);
339  }
340  }
341  }
342 
343 
364  public void LogVerify(string fpsActual, string fpsExpected)
365  {
366  foreach (ILogger myLogger in this.LoggerList)
367  {
368  myLogger.LogVerify(fpsActual, fpsExpected);
369  }
370  }
371 
377  public void LogWarning(string fps_Message)
378  {
379  foreach (ILogger myLogger in this.LoggerList)
380  {
381  myLogger.LogWarning(fps_Message);
382  }
383  }
384 
392  public void ResCloseList()
393  {
394  foreach (ILogger myLogger in this.LoggerList)
395  {
396  myLogger.ResCloseList();
397  }
398  }
399 
407  public void ResCloseListDebug()
408  {
409  if (this.cvbDebugMode)
410  {
411  foreach (ILogger myLogger in this.LoggerList)
412  {
413  myLogger.ResCloseList();
414  }
415  }
416  }
417 
426  public void ResOpenList(string fps_Name)
427  {
428  foreach (ILogger myLogger in this.LoggerList)
429  {
430  myLogger.ResOpenList(fps_Name);
431  }
432  }
433 
455  public void ResOpenListDebug(string fpsListCaption)
456  {
457  if (this.cvbDebugMode)
458  {
459  foreach (ILogger myLogger in this.LoggerList)
460  {
461  myLogger.ResOpenList(fpsListCaption);
462  }
463  }
464  }
465  #endregion Methods
466  }
467 }
void LogPrint(string fps_Message)
LogPrint Function: Prints the values of expressions to the results file.
Definition: Logger.cs:302
void ResOpenList(string fps_Name)
Creates a new hierarchical level in the results file. Use ResOpenList to start a new hierarchical lev...
Definition: Logger.cs:426
void LogException(string fps_Message)
LogException Function: Logs a Script Exception to the results file.
void LogException(string fps_Message)
LogException Function: Logs a Script Exception to the results file.
Definition: Logger.cs:155
void Init()
Initialisiert die Klasse.
Definition: Logger.cs:131
void LogPrint(string fps_Message)
LogPrint Function: Prints the values of expressions to the results file.
void LogWarning(string fps_Message)
LogWarning Function: Logs a warning to the results file.
void AddLogger(ILogger fpLogger)
Fügt einen ILogger der Logger-Liste Logger.LoggerList.
Definition: Logger.cs:110
void ResCloseList()
Closes the outline level.
void ResCloseListDebug()
Closes a hierarchical level in the results file that was opened with ResOpenList. Use ResOpenList to ...
Definition: Logger.cs:407
void LogVerify(string fpsActual, string fpsExpected)
Logt Soll-Ist Vergeleich.
Definition: Logger.cs:364
void LogError(string fps_Message)
LogError Function: Logs an error message to the results file.
Definition: Logger.cs:142
void LogKeyWordStart(string fpsKeyWordName, params string[] fpsParameter)
Ausgabe eines Schlüsselwortes.
Definition: Logger.cs:289
void LogPrintDebug(string fpsMessage)
Loggt eine Nachricht.
Definition: Logger.cs:332
void ResOpenListDebug(string fpsListCaption)
Erzeugt eine hierachische Log-Ebene in der Ergenbniss-Ausgabe.
Definition: Logger.cs:455
Debug Logs are not a part of Interface. This functions are Implemented in Logger.cs a Log*Debug funct...
Definition: ILogger.cs:62
void LogWarning(string fps_Message)
LogWarning Function: Logs a warning to the results file.
Definition: Logger.cs:377
void LogError(string fps_Message)
LogError Function: Logs an error message to the results file.
void ResCloseList()
Closes a hierarchical level in the results file that was opened with ResOpenList. Use ResOpenList to ...
Definition: Logger.cs:392
Definition: Core.cs:40