NSISLog plug-in

From NSIS Wiki
Jump to navigationJump to search

Download Link

Nsislog.zip (23 KB)

Description

With this plugin you can write some text to a textfile at install time.

The Script

Section "Log test"
  ... do something ...
  nsislog::log "$INSTDIR\install.log" "before registering my dll"
  RegDll "$INSTDIR\mydll.dll"
  nsislog::log "$INSTDIR\install.log" "after registering my dll"
  ... do something more ...
SectionEnd

At any time you can use different files for your logs. After the call, your text is written and the file is closed.

Note: Very useful to debug a installation without a compilation of the NSIS compiler.

Hope its useful.
McKenna

Plug-in free alternative

!include Util.nsh
!define LogLine "!insertmacro WriteLineToFile"
!macro WriteLineToFile file line
Push `${line}`
Push "${file}"
!insertmacro CallArtificialFunction WriteLineToFileHelper
!macroend
!macro WriteLineToFileHelper
Exch $0
Exch
Exch $1
FileOpen $0 $0 a
StrCmp $0 "" done
FileSeek $0 0 END
FileWrite $0 "$1$\r$\n"
FileClose $0
done:
Pop $1
Pop $0
!macroend
 
Section 
${LogLine} "$INSTDIR\install.log" "Hello"
${LogLine} "$INSTDIR\install.log" "World"
SectionEnd