Archive: LogSet Question


LogSet Question
Hello all.

On one of my longer installers, I just went through the whole script and added a bunch of "LogSet On" and "LogSet Off" commands so the resulting log file will not be so large, and only log what I want to be logged. This works well.

However, now I thought I would get smart, and leave myself the option for full logging, if need be, by doing something like this:


StrCmp $0 bla +3 ;some condition
!define LOG "On"
Goto +2
!define LOG "Off"

LogSet ${LOG}
...code that may or may not be logged

However when I try to compile my script, I get errors with both constants ( LogSet ${LOG} ) or even if I try variables ( LogSet $Log ). It seems that LogSet will only take hard coded "On" or "Off", is this right? Thanks all for your help.

Jnuw

You've got it all wrong I'm afraid.
!define is a compile time instruction and StrCmp is a run time instruction.

Does that code even compile?

-Stu


Oh yeah, I was running on only 3 hours of sleep yesterday... :( Anyhow, also tried:


StrCmp $0 bla +3 ;some condition
StrCpy $Log "On"
Goto +2
StrCpy $Log "Off"

LogSet $Log
...code that may or may not be logged

However that does not compile either. I'm guessing that LogSet is also a compile time command? That being said I can't use $Log which won't have a value till run time? If that's the case, is there any way I can vary how my script logs itself based on a runtime condition? I'm guessing no. Thanks for your help.

Jnuw

Why not:

StrCmp $0 bla +3       ;some condition
LogSet on
Goto +2
LogSet off


-Stu