Change verbosity for cake frosting project

171 Views Asked by At

I'm converting a cake script to a frosting project.

There are instructions for a script's verbosity. For frosting verbosity what I found was the --verbosity foo switch.

I tried two things:

  1. In the bootstrap script or the shell, I used --verbosity=foo

  2. I changed the verbosity of the dotnet commands: context.DotNetClean(path, new DotNetCleanSettings { Verbosity = DotNetVerbosity.Foo });

So it seems like there are two verbosities - of cake frosting itself, and of the dotnet tool. I can't control that of frosting - for example, I can't see what command was issued.

Is that possible with frosting? (If not, I could just log each command manually before calling it, not a big deal.)

2

There are 2 best solutions below

1
Pascal Berger On BEST ANSWER

If you run a Cake Frosting build with --verbosity=<VERBOSITY> (e.g. --verbosity=diagnostic) Cake Frosting runs with the specified diagnostic.

If you run tools, like dotnet from Cake verbosity is not automatically passed to the tool. Most aliases for tools have a property where you can define verbosity of the called tool, like you already mentioned:

context.DotNetClean(
  path, 
  new DotNetCleanSettings 
  { 
    Verbosity = DotNetVerbosity.Diagnostic 
  });

It is also possible to set the tool verbosity based on the verbosity Cake is currently running. You can retrieve the Cake verbosity from the context:

var currentCakeVerbosity = context.Log.Verbosity;
1
Nils On

@lonix, there are three places you can check:

  1. The bootstrapper: Make sure the bootstrapper "forwards" the arguments you give it to the call to dotnet. I.e. the PowerShell bootstrapper should end in -- $args

  2. The Main method should take the arguments from the commandline. I.e. the signature should be Main(string[] args)

  3. The arguments should be passed to frosting: Make sure that in .Run(args) of the CakeHost, the args are exactly those of the parameters of the Main method.

Also, be aware that verbose output in frosting looks a bit different from those of Cake scripting. (I.e. all the startup code of finding and loading modules/addins will not be there.)