LogEx plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 54: Line 54:
LogEx::Write /NOUNLOAD "Write this line to the log file only"
LogEx::Write /NOUNLOAD "Write this line to the log file only"
LogEx::Write /NOUNLOAD "Write this line to the log file and the status list box" true
LogEx::Write /NOUNLOAD "Write this line to the log file and the status list box" true
LogEx::Write /NOUNLOAD "Write this line to the log file, the status list box and the statusbar" true true</highlight-nsis>
LogEx::Write /NOUNLOAD "Write this line to the log file, the status list box and the statusbar" true true
LogEx::Write /NOUNLOAD 'Write complete "dir" output to the log file with ">" as prefix'
ExecDos::exec 'cmd /C dir' "" "$TEMP\output.log"
LogEx::AddFile "$TEMP\output.log" ">"
LogEx::Write /NOUNLOAD 'Write "dir" output from line3 to the log file'
ExecDos::exec 'cmd /C dir' "" "$TEMP\output.log"
LogEx::AddFile "$TEMP\output.log" "" 3
LogEx::Write /NOUNLOAD 'Write "dir" output from line3 to line8 to the log file'
ExecDos::exec 'cmd /C dir' "" "$TEMP\output.log"
LogEx::AddFile "$TEMP\output.log" "" 3 6
LogEx::Close</highlight-nsis>


== Notes ==
== Notes ==

Revision as of 00:50, 13 February 2007

Author: jpderuiter (talk, contrib)


Links

Exe.gif [] (77 KB)

Description

Version: 0.1.

LogEx is a logging plugin. It allows to append a string to a logfile and show this string in the status listbox and/or the status bar (like DetailPrint)

How To Use

The most practical way to use this plugin is disabling the PluginUnload. To do this call "SetPluginUnload alwaysoff" in all functions and sections where you use this plugin. ...

Init DLL Function

LogEx::Init /NOUNLOAD FileName
FileName
Log file name. The file will be opened with FILE_APPEND_DATA, so evt. old data will be left untouched.

Write DLL Function

LogEx::Write /NOUNLOAD LogString [bWriteToStatusList] [bWriteToStatusBar]
LogString
String to write to the logfile.
bWriteToStatusList
If equal to true, adds the string to the Status Listbox.
bWriteToStatusBar
If equal to true, adds the string to the Status Bar.

AddFile DLL Function

LogEx::AddFile /NOUNLOAD FileName Prefix
FileName
File to add to the logfile.
Prefix
Prefix to add at the beginning of each new line.

Close DLL Function

LogEx::Close

Example

LogEx::Init /NOUNLOAD "$TEMP\log.txt"
LogEx::Write /NOUNLOAD "Write this line to the log file only"
LogEx::Write /NOUNLOAD "Write this line to the log file and the status list box" true
LogEx::Write /NOUNLOAD "Write this line to the log file, the status list box and the statusbar" true true
LogEx::Write /NOUNLOAD 'Write complete "dir" output to the log file with ">" as prefix'
ExecDos::exec 'cmd /C dir' "" "$TEMP\output.log"
LogEx::AddFile "$TEMP\output.log" ">"
LogEx::Write /NOUNLOAD 'Write "dir" output from line3 to the log file'
ExecDos::exec 'cmd /C dir' "" "$TEMP\output.log"
LogEx::AddFile "$TEMP\output.log" "" 3
LogEx::Write /NOUNLOAD 'Write "dir" output from line3 to line8 to the log file'
ExecDos::exec 'cmd /C dir' "" "$TEMP\output.log"
LogEx::AddFile "$TEMP\output.log" "" 3 6
LogEx::Close

Notes

The LogEx::AddFile function is especially usefull in combination with execution of a console application (like ExecDos plug-in)

Version History

[version 0.1: 2007-02-12] Initial version.

JP de Ruiter