markus / MarkusLogview / ServiceInterface / ServiceEventLogger.cs @ master
이력 | 보기 | 이력해설 | 다운로드 (1.22 KB)
1 | 84578b97 | djkim | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Web; |
||
5 | using System.Diagnostics; |
||
6 | using static ServiceInterface.LogView_Interface; |
||
7 | |||
8 | namespace ServiceInterface |
||
9 | { |
||
10 | |||
11 | public class ServiceEventLogger_db |
||
12 | { |
||
13 | |||
14 | //private string sSource = "SignalR Windows Service"; |
||
15 | private string sSource = "Logview Dependency"; |
||
16 | private string sLog = "Application"; |
||
17 | private string sEvent = "Event"; |
||
18 | |||
19 | |||
20 | public void WriteEventEntry(string msg, EventLogEntryType eType) |
||
21 | { |
||
22 | |||
23 | if (!EventLog.SourceExists(sSource)) |
||
24 | { |
||
25 | EventLog.CreateEventSource(sSource, sLog); |
||
26 | } |
||
27 | |||
28 | EventLog.WriteEntry(sSource, msg, eType); |
||
29 | |||
30 | } |
||
31 | |||
32 | } |
||
33 | |||
34 | public class ServiceEventLogger |
||
35 | { |
||
36 | |||
37 | private string sSource = "SignalR Windows Service"; |
||
38 | private string sLog = "Application"; |
||
39 | private string sEvent = "Event"; |
||
40 | |||
41 | |||
42 | public void WriteEventEntry( string msg , EventLogEntryType eType ) |
||
43 | { |
||
44 | |||
45 | if (!EventLog.SourceExists(sSource)) |
||
46 | { |
||
47 | EventLog.CreateEventSource(sSource, sLog); |
||
48 | } |
||
49 | |||
50 | EventLog.WriteEntry(sSource, msg, eType); |
||
51 | |||
52 | } |
||
53 | |||
54 | } |
||
55 | } |