EventLog plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
mNo edit summary
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{PageAuthor|sgiusto@mmpoint.it}}
{{PageAuthor|sgiusto@mmpoint.it}}


== Links ==
== Download ==
 
<attach>EventLog.zip</attach>
<attach>EventLog.zip</attach>


Line 18: Line 17:
---------
---------


WriteEventLog <server> <log> <type> <category> <message> <text>
<highlight-nsis>EventLog::WriteEventLog <server> <log> <type> <category> <message> <text></highlight-nsis>
Writes and event to the EventLog
 
<server>   Network name of PC to write events to
Writes an event to the EventLog
          Leave blank to write to local PC
Returns 1 on failure, 0 on success
<log>     Event log to write  
 
          Standard windows Event Logs are "System" and "Application"
;<server>
          but other can be defined by user. If specific event log
:Network name of PC to write events to
          is not found "Application" will be used
:Leave blank to write to local PC
<type>     Type of message to write
;<log>
  "0" - Information
:Event log to write  
  "1" - Error
:Standard windows Event Logs are "System" and "Application"
  "2" - Warning
:but other can be defined by user. If specific event log
<category> Event category. Can be any value and is specific to the event
:is not found "Application" will be used
  log currently written.
;<type>
<message> ID of the message to write. This id is specific to the event
:Type of message to write
          log currently written.
:*"0" - Information
<text>     Message text to write to event log (up to 1024 bytes)  
:*"1" - Error
:*"2" - Warning
;<category>
:Event category. Can be any value and is specific to the event log currently written.
:*"0" - None
:*"1" - Devices
:*"2" - Disk
:*"3" - Printers
:*"4" - Services
:*"5" - Shell
:*"6" - System
:*"7" - Network
;<message>
:ID of the message to write. This id is specific to the event log currently written.
;<text>
:Message text to write to event log (up to 1024 bytes)


== Usage Example ==
== Usage Example ==
Line 40: Line 54:
#Write an informational message in a Custom Event Log
#Write an informational message in a Custom Event Log
EventLog::WriteEventLog '' 'EventLogTest' '0' '0' '1' 'Info'
EventLog::WriteEventLog '' 'EventLogTest' '0' '0' '1' 'Info'
pop $0
#Handle result
</highlight-nsis>
</highlight-nsis>


== Credits ==
== Credits ==
Written by Stefano Giusto [sgiusto@mmpoint.it]
Written by Stefano Giusto [sgiusto@mmpoint.it]
Modified : add category's description by Ricardo Cardoso


[[Category:Plugins]]
[[Category:Plugins]]

Latest revision as of 10:27, 15 December 2009

Author: sgiusto@mmpoint.it (talk, contrib)


Download

EventLog.zip (34 KB)

Description

Version: 5th March 2007.
Supported on: Windows NT, Windows 2000, Windows XP.


The EventLog plugin for NSIS provides a function to write Events to the windows Event Log.


FUNCTIONS


EventLog::WriteEventLog <server> <log> <type> <category> <message> <text>

Writes an event to the EventLog Returns 1 on failure, 0 on success

<server>
Network name of PC to write events to
Leave blank to write to local PC
<log>
Event log to write
Standard windows Event Logs are "System" and "Application"
but other can be defined by user. If specific event log
is not found "Application" will be used
<type>
Type of message to write
  • "0" - Information
  • "1" - Error
  • "2" - Warning
<category>
Event category. Can be any value and is specific to the event log currently written.
  • "0" - None
  • "1" - Devices
  • "2" - Disk
  • "3" - Printers
  • "4" - Services
  • "5" - Shell
  • "6" - System
  • "7" - Network
<message>
ID of the message to write. This id is specific to the event log currently written.
<text>
Message text to write to event log (up to 1024 bytes)

Usage Example

#Write an informational message in a Custom Event Log
EventLog::WriteEventLog '' 'EventLogTest' '0' '0' '1' 'Info'
pop $0
#Handle result

Credits

Written by Stefano Giusto [sgiusto@mmpoint.it]

Modified : add category's description by Ricardo Cardoso