Rev 2 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 3 | ||
---|---|---|---|
1 | 1 | ||
2 | What is "ViaThinkSoft Simple Log Event"? |
2 | What is "ViaThinkSoft Simple Log Event"? |
3 | ---------------------------------------- |
3 | ---------------------------------------- |
4 | 4 | ||
5 | ViaThinkSoftSimpleLogEvent offers a COM interface for easily |
5 | ViaThinkSoftSimpleLogEvent offers a COM interface for easily |
6 | logging things into the Windows Event Log. |
6 | logging things into the Windows Event Log. |
7 | 7 | ||
8 | Using a COM interface enables some applications which cannot |
8 | Using a COM interface enables some applications which cannot |
9 | call arbitary DLL functions (like PHP) to write to the Event Log. |
9 | call arbitary DLL functions (like PHP) to write to the Event Log. |
10 | 10 | ||
11 | Additionally, ViaThinkSoftSimpleLogEvent registeres a "Log Event Provider" |
11 | Additionally, ViaThinkSoftSimpleLogEvent registeres a "Log Event Provider" |
12 | which will prevent the message "The description for Event ID ... from source ... cannot be found" |
12 | which will prevent the message "The description for Event ID ... from source ... cannot be found" |
13 | that would show up if you would call the WinAPI function "ReportEvent" |
13 | that would show up if you would call the WinAPI function "ReportEvent" |
14 | without MessageTable/Provider. |
14 | without MessageTable/Provider. |
15 | 15 | ||
16 | 16 | ||
17 | Distribution to the end user (files found in folder "TLB") |
17 | Distribution to the end user |
18 | ---------------------------- |
18 | ---------------------------- |
19 | 19 | ||
- | 20 | You only need to deploy SimpleLogEventSetup.exe |
|
20 | Register.bat |
21 | which is located in the folder "Setup". |
- | 22 | ||
21 | UnRegister.bat |
23 | The EXE file contains everything inside: |
- | 24 | - 32 bit and 64 bit DLL (will be unpacked to target location) |
|
22 | ViaThinkSoftSimpleLogEvent32.dll |
25 | - Registration procedure for COM/Typelib |
23 | ViaThinkSoftSimpleLogEvent64.dll |
26 | - Registration procedure for SourceNames |
24 | 27 | ||
25 | 28 | ||
26 | Installation |
29 | Installation |
27 | ------------ |
30 | ------------ |
28 | 31 | ||
29 | Copy the following files in a path of your choice: |
32 | Copy the following files in a path of your choice: |
30 | 33 | ||
31 | Register.bat |
34 | Register.bat |
32 | UnRegister.bat |
35 | UnRegister.bat |
33 | ViaThinkSoftSimpleLogEvent32.dll |
36 | ViaThinkSoftSimpleLogEvent32.dll |
34 | ViaThinkSoftSimpleLogEvent64.dll |
37 | ViaThinkSoftSimpleLogEvent64.dll |
35 | 38 | ||
36 | Run Register.bat as administrator (right click on the batch file). |
39 | Run Register.bat as administrator (right click on the batch file). |
37 | 40 | ||
38 | Please do not move the DLL files after they were registered; |
41 | Please do not move the DLL files after they were registered; |
39 | otherwise you need to re-register them. |
42 | otherwise you need to re-register them. |
40 | 43 | ||
41 | If you want to use ViaThinkSoftSimpleLogEvent with PHP, you need to change |
44 | If you want to use ViaThinkSoftSimpleLogEvent with PHP, you need to change |
42 | following settings in your PHP.ini: |
45 | following settings in your PHP.ini: |
43 | 46 | ||
44 | extension_dir = "ext" |
47 | extension_dir = "ext" |
45 | extension=com_dotnet |
48 | extension=com_dotnet |
46 | 49 | ||
47 | 50 | ||
48 | Example usage with VBScript |
51 | Example usage with VBScript |
49 | --------------------------- |
52 | --------------------------- |
50 | 53 | ||
51 | Dim objMyObject |
54 | Dim objMyObject |
52 | 55 | ||
53 | set objMyObject = CreateObject("ViaThinkSoftSimpleLogEvent.ViaThinkSoftSimpleEventLog") |
56 | set objMyObject = CreateObject("ViaThinkSoftSimpleLogEvent.ViaThinkSoftSimpleEventLog") |
54 | 57 | ||
55 | const LOGEVENT_MSG_SUCCESS = 0 |
58 | const LOGEVENT_MSG_SUCCESS = 0 |
56 | const LOGEVENT_MSG_INFORMATIONAL = 1 |
59 | const LOGEVENT_MSG_INFORMATIONAL = 1 |
57 | const LOGEVENT_MSG_WARNING = 2 |
60 | const LOGEVENT_MSG_WARNING = 2 |
58 | const LOGEVENT_MSG_ERROR = 3 |
61 | const LOGEVENT_MSG_ERROR = 3 |
59 | 62 | ||
60 | objMyObject.LogEvent LOGEVENT_MSG_WARNING, "This is a test warning written by VBS" |
63 | objMyObject.LogEvent "MySourceName", LOGEVENT_MSG_WARNING, "This is a test warning written by VBS" |
61 | 64 | ||
62 | 65 | ||
63 | Example usage with PHP |
66 | Example usage with PHP |
64 | ---------------------- |
67 | ---------------------- |
65 | 68 | ||
66 | define('CLASS_ViaThinkSoftSimpleEventLog', '{E4270053-A217-498C-B395-9EF33187E8C2}'); |
69 | define('CLASS_ViaThinkSoftSimpleEventLog', '{E4270053-A217-498C-B395-9EF33187E8C2}'); |
67 | 70 | ||
68 | define('LOGEVENT_MSG_SUCCESS', 0); |
71 | define('LOGEVENT_MSG_SUCCESS', 0); |
69 | define('LOGEVENT_MSG_INFORMATIONAL', 1); |
72 | define('LOGEVENT_MSG_INFORMATIONAL', 1); |
70 | define('LOGEVENT_MSG_WARNING', 2); |
73 | define('LOGEVENT_MSG_WARNING', 2); |
71 | define('LOGEVENT_MSG_ERROR', 3); |
74 | define('LOGEVENT_MSG_ERROR', 3); |
72 | 75 | ||
73 | $x = new COM(CLASS_ViaThinkSoftSimpleEventLog); |
76 | $x = new COM(CLASS_ViaThinkSoftSimpleEventLog); |
74 | $x->LogEvent(LOGEVENT_MSG_WARNING, 'This is a test warning written by PHP'); |
77 | $x->LogEvent('MySourceName', LOGEVENT_MSG_WARNING, 'This is a test warning written by PHP'); |
75 | 78 | ||
76 | 79 | ||
77 | Example usage with Delphi |
80 | Example usage with Delphi |
78 | ------------------------- |
81 | ------------------------- |
79 | 82 | ||
80 | uses |
83 | uses |
81 | ActiveX, |
84 | ActiveX, |
82 | ViaThinkSoftSimpleLogEvent_TLB; |
85 | ViaThinkSoftSimpleLogEvent_TLB; |
83 | 86 | ||
84 | const |
- | |
85 | LOGEVENT_MSG_SUCCESS = 0; |
- | |
86 | LOGEVENT_MSG_INFORMATIONAL = 1; |
- | |
87 | LOGEVENT_MSG_WARNING = 2; |
- | |
88 | LOGEVENT_MSG_ERROR = 3; |
- | |
89 | - | ||
90 | procedure LogTest; |
87 | procedure LogTest; |
91 | var |
88 | var |
92 | x: IViaThinkSoftSimpleEventLog; |
89 | x: IViaThinkSoftSimpleEventLog; |
93 | begin |
90 | begin |
94 | CoInitialize(nil); // <-- only needs to be called once |
91 | CoInitialize(nil); // needs to be called only once |
95 | x := CoViaThinkSoftSimpleEventLog.Create; |
92 | x := CoViaThinkSoftSimpleEventLog.Create; |
96 | x.LogEvent(LOGEVENT_MSG_WARNING, 'This is a test warning written by Delphi'); |
93 | x.LogEvent('MySourceName', ViaThinkSoftSimpleLogEvent_TLB.Warning, 'This is a test warning written by Delphi'); |
97 | x := nil; |
94 | x := nil; |
98 | end. |
95 | end. |
99 | 96 | ||
- | 97 | ||
- | 98 | A short note about the compilation workflow (for developers) |
|
- | 99 | ------------------------------------------- |
|
- | 100 | ||
- | 101 | This only applies if you want to change/extend/fork ViaThinkSoftSimpleEventLog yourself. |
|
- | 102 | You do not need this if you just want to use ViaThinkSoftSimpleEventLog to log events. |
|
- | 103 | ||
- | 104 | 1. In folder "MessageTable": |
|
- | 105 | Run "EventlogMessagesCompile.bat", it will do: |
|
- | 106 | - MC file => RC+BIN files (using "mc.exe" from Windows SDK) |
|
- | 107 | - RC+BIN files => RES file (using "rc.exe") |
|
- | 108 | ||
- | 109 | 2. In folder "TLB": |
|
- | 110 | Compile using Delphi (it will include the MessageTable RES file): |
|
- | 111 | - ViaThinkSoftSimpleLogEvent32.dll |
|
- | 112 | - ViaThinkSoftSimpleLogEvent64.dll |
|
- | 113 | ||
- | 114 | 3. In folder "Setup": |
|
- | 115 | 3.1 Run "DllResCompile.bat", it will do: |
|
- | 116 | - RC file => RES file (will include the two DLLs from folder "TLB") |
|
- | 117 | 3.2 Then, compile SimpleLogEventSetup.exe using Delphi |
|
- | 118 | ||
- | 119 | 4. In folder "LogTestUsingDelphi": |
|
- | 120 | Compile LogWriteTestDelphi*.exe using Delphi |
|
- | 121 | (it will read "ViaThinkSoftSimpleLogEvent_TLB.pas" from the "TLB" folder) |
|
- | 122 | ||
100 | 123 | ||
101 | License |
124 | License |
102 | ------- |
125 | ------- |
103 | 126 | ||
104 | ViaThinkSoft Simple Log Event |
127 | ViaThinkSoft Simple Log Event |
105 | Copyright 2020 Daniel Marschall, ViaThinkSoft |
128 | Copyright 2020 Daniel Marschall, ViaThinkSoft |
106 | 129 | ||
107 | Licensed under the Apache License, Version 2.0 (the "License"); |
130 | Licensed under the Apache License, Version 2.0 (the "License"); |
108 | you may not use this file except in compliance with the License. |
131 | you may not use this file except in compliance with the License. |
109 | You may obtain a copy of the License at |
132 | You may obtain a copy of the License at |
110 | 133 | ||
111 | http://www.apache.org/licenses/LICENSE-2.0 |
134 | http://www.apache.org/licenses/LICENSE-2.0 |
112 | 135 | ||
113 | Unless required by applicable law or agreed to in writing, software |
136 | Unless required by applicable law or agreed to in writing, software |
114 | distributed under the License is distributed on an "AS IS" BASIS, |
137 | distributed under the License is distributed on an "AS IS" BASIS, |
115 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
138 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
116 | See the License for the specific language governing permissions and |
139 | See the License for the specific language governing permissions and |
117 | limitations under the License. |
140 | limitations under the License. |