Rev 2 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 3 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | ComObj, ActiveX, ViaThinkSoftSimpleLogEvent_TLB, StdVcl; |
8 | ComObj, ActiveX, ViaThinkSoftSimpleLogEvent_TLB, StdVcl; |
9 | 9 | ||
10 | type |
10 | type |
11 | TViaThinkSoftSimpleEventLog = class(TAutoObject, IViaThinkSoftSimpleEventLog) |
11 | TViaThinkSoftSimpleEventLog = class(TAutoObject, IViaThinkSoftSimpleEventLog) |
12 | protected |
12 | protected |
13 | procedure LogEvent(EventType: Integer; const LogMsg: WideString); safecall; |
13 | procedure LogEvent(const SourceName: WideString; EventType: LogEventType; const LogMsg: WideString); |
- | 14 | safecall; |
|
14 | end; |
15 | end; |
15 | 16 | ||
16 | const |
- | |
17 | LOGEVENT_PROVIDER_NAME = 'ViaThinkSoft'; |
- | |
18 | - | ||
19 | implementation |
17 | implementation |
20 | 18 | ||
21 | uses ComServ, Windows; |
19 | uses ComServ, Windows; |
22 | 20 | ||
23 | const |
21 | const |
Line 49... | Line 47... | ||
49 | finally |
47 | finally |
50 | DeregisterEventSource(EventLog); |
48 | DeregisterEventSource(EventLog); |
51 | end; |
49 | end; |
52 | end; |
50 | end; |
53 | 51 | ||
54 | procedure TViaThinkSoftSimpleEventLog.LogEvent(EventType: Integer; |
52 | procedure TViaThinkSoftSimpleEventLog.LogEvent(const SourceName: WideString; EventType: LogEventType; |
55 | const LogMsg: WideString); |
53 | const LogMsg: WideString); |
56 | begin |
54 | begin |
57 | case EventType of |
55 | case EventType of |
58 | 0: |
56 | ViaThinkSoftSimpleLogEvent_TLB.Success: |
59 | WriteEventLog(LOGEVENT_PROVIDER_NAME, EVENTLOG_SUCCESS, MSG_SUCCESS, LogMsg); |
57 | WriteEventLog(SourceName, EVENTLOG_SUCCESS, MSG_SUCCESS, LogMsg); |
60 | 1: |
58 | ViaThinkSoftSimpleLogEvent_TLB.Informational: |
61 | WriteEventLog(LOGEVENT_PROVIDER_NAME, EVENTLOG_INFORMATION_TYPE, MSG_INFORMATIONAL, LogMsg); |
59 | WriteEventLog(SourceName, EVENTLOG_INFORMATION_TYPE, MSG_INFORMATIONAL, LogMsg); |
62 | 2: |
60 | ViaThinkSoftSimpleLogEvent_TLB.Warning: |
63 | WriteEventLog(LOGEVENT_PROVIDER_NAME, EVENTLOG_WARNING_TYPE, MSG_WARNING, LogMsg); |
61 | WriteEventLog(SourceName, EVENTLOG_WARNING_TYPE, MSG_WARNING, LogMsg); |
64 | 3: |
62 | ViaThinkSoftSimpleLogEvent_TLB.Error: |
65 | WriteEventLog(LOGEVENT_PROVIDER_NAME, EVENTLOG_ERROR_TYPE, MSG_ERROR, LogMsg); |
63 | WriteEventLog(SourceName, EVENTLOG_ERROR_TYPE, MSG_ERROR, LogMsg); |
66 | else |
- | |
67 | // TODO: Exception/Error ? |
- | |
68 | end; |
64 | end; |
69 | end; |
65 | end; |
70 | 66 | ||
71 | initialization |
67 | initialization |
72 | TAutoObjectFactory.Create(ComServer, TViaThinkSoftSimpleEventLog, Class_ViaThinkSoftSimpleEventLog, |
68 | TAutoObjectFactory.Create(ComServer, TViaThinkSoftSimpleEventLog, Class_ViaThinkSoftSimpleEventLog, |