Subversion Repositories simple_log_event

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
 
2
What is "ViaThinkSoft Simple Log Event"?
3
----------------------------------------
4
 
5
ViaThinkSoftSimpleLogEvent offers a COM interface for easily
6
logging things into the Windows Event Log.
7
 
8
Using a COM interface enables some applications which cannot
9
call arbitary DLL functions (like PHP) to write to the Event Log.
10
 
11
Additionally, ViaThinkSoftSimpleLogEvent registeres a "Log Event Provider"
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"
14
without MessageTable/Provider.
15
 
16
 
3 daniel-mar 17
Distribution to the end user
2 daniel-mar 18
----------------------------
19
 
3 daniel-mar 20
You only need to deploy SimpleLogEventSetup.exe
21
which is located in the folder "Setup".
2 daniel-mar 22
 
3 daniel-mar 23
The EXE file contains everything inside:
24
- 32 bit and 64 bit DLL (will be unpacked to target location)
25
- Registration procedure for COM/Typelib
26
- Registration procedure for SourceNames
2 daniel-mar 27
 
3 daniel-mar 28
 
2 daniel-mar 29
Installation
30
------------
31
 
32
Copy the following files in a path of your choice:
33
 
34
	Register.bat
35
	UnRegister.bat
36
	ViaThinkSoftSimpleLogEvent32.dll
37
	ViaThinkSoftSimpleLogEvent64.dll
38
 
39
Run Register.bat as administrator (right click on the batch file).
40
 
41
Please do not move the DLL files after they were registered;
42
otherwise you need to re-register them.
43
 
44
If you want to use ViaThinkSoftSimpleLogEvent with PHP, you need to change
45
following settings in your PHP.ini:
46
 
47
	extension_dir = "ext"
48
	extension=com_dotnet
49
 
50
 
51
Example usage with VBScript
52
---------------------------
53
 
54
	Dim objMyObject
55
 
56
	set objMyObject = CreateObject("ViaThinkSoftSimpleLogEvent.ViaThinkSoftSimpleEventLog")
57
 
58
	const LOGEVENT_MSG_SUCCESS       = 0
59
	const LOGEVENT_MSG_INFORMATIONAL = 1
60
	const LOGEVENT_MSG_WARNING       = 2
61
	const LOGEVENT_MSG_ERROR         = 3
62
 
3 daniel-mar 63
	objMyObject.LogEvent "MySourceName", LOGEVENT_MSG_WARNING, "This is a test warning written by VBS"
2 daniel-mar 64
 
65
 
66
Example usage with PHP
67
----------------------
68
 
69
	define('CLASS_ViaThinkSoftSimpleEventLog', '{E4270053-A217-498C-B395-9EF33187E8C2}');
70
 
71
	define('LOGEVENT_MSG_SUCCESS',       0);
72
	define('LOGEVENT_MSG_INFORMATIONAL', 1);
73
	define('LOGEVENT_MSG_WARNING',       2);
74
	define('LOGEVENT_MSG_ERROR',         3);
75
 
76
	$x = new COM(CLASS_ViaThinkSoftSimpleEventLog);
3 daniel-mar 77
	$x->LogEvent('MySourceName', LOGEVENT_MSG_WARNING, 'This is a test warning written by PHP');
2 daniel-mar 78
 
79
 
80
Example usage with Delphi
81
-------------------------
82
 
83
	uses
84
	  ActiveX,
85
	  ViaThinkSoftSimpleLogEvent_TLB;
86
 
87
	procedure LogTest;
88
	var
89
	  x: IViaThinkSoftSimpleEventLog;
90
	begin
3 daniel-mar 91
	  CoInitialize(nil); // needs to be called only once
2 daniel-mar 92
	  x := CoViaThinkSoftSimpleEventLog.Create;
3 daniel-mar 93
	  x.LogEvent('MySourceName', ViaThinkSoftSimpleLogEvent_TLB.Warning, 'This is a test warning written by Delphi');
2 daniel-mar 94
	  x := nil;
95
	end.
96
 
97
 
3 daniel-mar 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
 
123
 
2 daniel-mar 124
License
125
-------
126
 
127
ViaThinkSoft Simple Log Event
128
Copyright 2020 Daniel Marschall, ViaThinkSoft
129
 
130
Licensed under the Apache License, Version 2.0 (the "License");
131
you may not use this file except in compliance with the License.
132
You may obtain a copy of the License at
133
 
134
    http://www.apache.org/licenses/LICENSE-2.0
135
 
136
Unless required by applicable law or agreed to in writing, software
137
distributed under the License is distributed on an "AS IS" BASIS,
138
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139
See the License for the specific language governing permissions and
140
limitations under the License.