Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Diagnostics;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Hive.Client.Common {
|
---|
8 | public class Logging {
|
---|
9 | private static Logging instance = null;
|
---|
10 | private EventLog eventLogger = null;
|
---|
11 |
|
---|
12 | public static Logging getInstance() {
|
---|
13 | if (instance == null)
|
---|
14 | instance = new Logging();
|
---|
15 | return instance;
|
---|
16 | }
|
---|
17 |
|
---|
18 | private Logging() {
|
---|
19 | eventLogger = new EventLog("Hive Client Core");
|
---|
20 | }
|
---|
21 |
|
---|
22 | public void Info(String source, String message) {
|
---|
23 | eventLogger.Source = source;
|
---|
24 | eventLogger.WriteEntry(message);
|
---|
25 | eventLogger.Close();
|
---|
26 | }
|
---|
27 |
|
---|
28 | public void Error(String source, String message) {
|
---|
29 | eventLogger.Source = source;
|
---|
30 | eventLogger.WriteEntry(message, EventLogEntryType.Error);
|
---|
31 | eventLogger.Close();
|
---|
32 | }
|
---|
33 |
|
---|
34 | public void Error(String source, String message, Exception e) {
|
---|
35 | eventLogger.Source = source;
|
---|
36 | eventLogger.WriteEntry(message +"\n" + e.ToString(), EventLogEntryType.Error);
|
---|
37 | eventLogger.Close();
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.