PDA

View Full Version : How to propagate loglevel to child bld files?


raistlin
11-07-2014, 04:03 PM
Hi,

I would like to limit the amount of information / logs produced by my bld script to the console. I use Jenkins, so i would very much like to achieve a much smaller blueprint of logs.

This is the command line i use for my continuous integration build:
VisBuildcmd.exe Build.bld /loglevel vbldLogLevelError

When the build is successful, the logs produced is of course minimal. But when the build fails, i use LogMessage2 with vbldLogLevelError to ensure errors that i want to see is visible on the console. No problem with this setup.

Now, when i have a child bld script that i call within Build.bld, /loglevel information is not propagated to that executing process, so i get a vbldLogLevelNormal verbosity from the child bld.

How can i propagate /loglevel being parsed from the parent bld script, to child scripts?

Thank you.
Lee

kinook
11-07-2014, 05:16 PM
Pass in another macro value with the log level and use that when calling the child project, specifying the log level.

raistlin
11-07-2014, 05:57 PM
Thanks. Can you also include a small snippet with VBS on how to set the loglevel in the child when received?

On how to use the following:
Options.LogLevel As LogLevelEnum

I can iterate macros, but not sure which property to set with the temp loglevel macro value received in the child script.

Please excuse my inability to pickup VBS. Thanks for the help.

kinook
11-07-2014, 11:14 PM
Application.Options.LogLevel = %LEVEL_MACRO%

raistlin
11-08-2014, 07:17 AM
Thank you.

raistlin
11-10-2014, 08:34 AM
I found an interesting observation. Please correct me if i am wrong. In the documentation, it says:


vbldLogLevelNone 0 No calls to LogMessage will be logged.
vbldLogLevelError 1 Only error level messages will be logged.
vbldLogLevelWarning 2 Only error and warning level error messages will be logged.
vbldLogLevelNormal 3 Errors, warnings, and normal level error messages will be logged.
vbldLogLevelDetailed 4 Errors, warnings, normal, and detailed error messages will be logged.
vbldLogLevelDiagnostic 5 Errors, warnings, normal, detailed, and diagnostic error messages will be logged.



But the number associated with these parameters are off by 1.
vbldLogLevelNone starts at -1, vbldLogLevelError at 0 and so on.

I tested this with:

Builder.LogMessage2 "vbldLogLevelError = " & vbldLogLevelError, vbldLogLevelError

kinook
11-10-2014, 09:10 AM
You're right, the values in the help are off by one.

raistlin
11-10-2014, 09:26 AM
Thanks for clarifying.

Is there any variable to get the process' log level during execution?

Application.Options.LogLevel only provided the settings set in Application Options > Logging (More) > Log level.

I am thinking to get the log level parsed via /loglevel in command line parameter instead of it being parsed as a temp macro.

Thanks.

kinook
11-10-2014, 10:25 AM
No, there isn't a way to get that info.