Search code examples
cakebuild

Change verbosity for cake frosting project


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.)


Solution

  • 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;