nuke
nuke copied to clipboard
Add support for FileLogger and FileLoggerParameters in MSBuildSettings.
MSBuild supports the parameters -fileLogger
and -fileLoggerParameters
to enable additional logging to a file. Would be nice to have these easily accessible in the MSBuildSettings
.
A suggested interface would be something like the following:
MSBuild(s => s
.SetTargetPath(Solution)
.SetTargets("Build")
.SetFileLogger(f => f
.SetLogFile("MyLogFile.log")
.SetVerbosity(MSBuildVerbosity.Diagnostic)
.EnableShowTimestamp()
.EnableAppend()
)
.SetNodeReuse(IsLocalBuild));
This should result in the command line:
msbuild.exe <solution> /t:Build /fl /flp:"LogFile=MyLogFile.log;Verbosity=Diagnostic;Append;ShowTimestamp"
I currently don't see a way to autogenerate code for this type of parameter specification. It is quite specialized. I would be happy to manually implement this and submit a PR if that would be an admissible solution.
MSBuild.json
would require additional dataclasses, depending on the amount of logger types. Also I suggest to extend code generation to allow some sort of callback, that gets implemented manually (for now) in another partial file. Convenience methods like ClearLoggers
should be guaranteed.
Took a brief initial look at this, and it seems quite doable using the dataClasses and a customValue
implementation for the actual parameter that is manually implemented. Don't see the need for an additional callback method at this point, but perhaps I'm missing something?
I'm planning to take a stab at it and submit a PR when done though.
Binary log files exist meanwhile.