How can I see the logs from `printfn` from WebSharper Interface Generator ?
Hello,
I am trying to adapt/generate a binding using WIG and I see in some projects like Highcharts usage of printfn but when giving it a try I don't see any logs from my code.
How can I see the logs coming from printfn invocation?
I am using WS 9
My workaround for now is to log to a file:
module Log =
let private logFile = __SOURCE_DIRECTORY__ + "/HighchartsGenerator.log"
let write (msg: string) =
try
File.AppendAllText(logFile, msg + Environment.NewLine)
with _ -> ()
It works for debugging purpose but if I wanted to generate warnings of something similar it would be less ideal.
Also, I am thinking there is a way to see printfn log because it is used in some of the official binding but my assumption can be wrong.
@MangelMaxime Might be because you have the compiler service running. Use "standalone": true in wsconfig.json or WebSharperBuildService=False environment variable.
The compiler-level fix could be is to use System.Console.SetOut with a custom TextWriter in the compiler service, because it needs to send the output lines through a Pipe for the right process waiting on that single compilation.
We need to figure out how these messages can be funnelled through the Booster too. @Jooseppi12 any idea why they are lost ATM?
@Jand42 After trying your suggestions it seems like only export WebSharperBuildService=false work for me. However, only the logs prefixed with warning: seems to be printed.
So it seems like WS is filtering what to output, there are perhaps support for info, and other categories
Also if I have 3 projects, do I need one wsconfig.json per project? I suspect this is the reason why only when setting the env variable I do get the logs printed.
In detailed MSBuild output I think you should see normal printed lines too. (but yes, still in standalone mode only, bc booster does not capture what goes to its stdout)
Where the compiler looks for the WS config json file can be configured by project property WebSharperConfigFile (defaults to wsconfig.$(MSBuildProjectName).json first if exists, then to wsconfig.json if exists)