Subversion Repositories simple_log_event

Rev

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 12... Line 12...
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
 
Line 55... Line 58...
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
 
Line 69... Line 72...
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
 
100
 
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
 
-
 
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