How can I print logs in the Module.Build.cs file

I tried Console.writeline() and Log.TraceInformation(), but neither of them can work? Thanks for the help.

Include Tools.DotNETCommon at the top of your Build.cs file:

using Tools.DotNETCommon

then you can use Log.TraceInformation or Log.TraceWarning like this:

Log.TraceWarning("My log with a parameter: {0}", MyParameter);