anotheraiuser
Posts: 3
Joined: Thu Jul 04, 2024 10:13 am

Adding custom text to the Verbose log

So, I have enabled the verbose logging through the GUI and was wondering if there was a way to add a execution results to the log from a JavaScript file.

Right now I have accessed the properties inside the JavaScript and wanted to write a its result in the log. Like we have Write-Output for PowerShell scripts which writes the result in the log, is there a similar function in JavaScript that can do the same thing maybe something like Session.Log("");
Catalin
Posts: 7513
Joined: Wed Jun 13, 2018 7:49 am

Re: Adding custom text to the Verbose log

Hello and welcome to our forums,

I'm afraid that I am not quite experienced when it comes to JavaScript and therefore I do not really know whether there is a function to add text to your log or not.

As per Microsoft's documentation, it would look like the Session should work from within your JScript:

Custom Action type 37

(check the "Remarks" section)

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anotheraiuser
Posts: 3
Joined: Thu Jul 04, 2024 10:13 am

Re: Adding custom text to the Verbose log

Thanks for the quick reply Catalin, the documentation was indeed helpful.

For anyone having to do the same:

You first have to import the "Session Object" and then use the Session.Message method to insert the record in the verbose log.

The links are:

https://learn.microsoft.com/en-us/windo ... ion-object (for the session object)
https://learn.microsoft.com/en-us/windo ... on-message (for the session message)
Catalin
Posts: 7513
Joined: Wed Jun 13, 2018 7:49 am

Re: Adding custom text to the Verbose log

You are always welcome!

And thank you for sharing your solution with us.

I'm sure this will be of help for further users facing a similar scenario.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”