Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Logger.cs @ 5511

Last change on this file since 5511 was 5511, checked in by cneumuel, 14 years ago

#1233

  • added StateLog to log state transitions of hive jobs
  • added permissions to hive experiments (in data access layer, no UI for that yet)
  • extended unit tests
File size: 1.1 KB
Line 
1using System;
2using System.Diagnostics;
3
4namespace HeuristicLab.Services.Hive.Common {
5  public class LogFactory {
6    public static ILogger GetLogger(string source) {
7      return new Logger("HeuristicLab.Hive", source);
8    }
9  }
10
11  public interface ILogger {
12    void Log(string message);
13    void Error(Exception e);
14  }
15
16  internal class Logger : ILogger {
17    private EventLog log;
18
19    public Logger(string name, string source) {
20      //if (!EventLog.SourceExists(name)) {
21      //  EventLog.CreateEventSource(source, name);
22      //}
23      //log = new EventLog(name);
24      //log.Source = source;
25    }
26
27    public void Log(string message) {
28      //log.WriteEntry(string.Format("{0} (AppDomain: {1}, Thread: {2})", message, AppDomain.CurrentDomain.Id, Thread.CurrentThread.ManagedThreadId), EventLogEntryType.Information);
29    }
30
31    public void Error(Exception e) {
32      //log.WriteEntry(string.Format("{0} (AppDomain: {1}, Thread: {2})", e.Message, AppDomain.CurrentDomain.Id, Thread.CurrentThread.ManagedThreadId), EventLogEntryType.Error);
33    }
34  }
35}
Note: See TracBrowser for help on using the repository browser.