0

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

lonix
  • 14,255
  • 23
  • 85
  • 176
  • Are you saying that running `dotnet run -- --verbosity=diagnostic` does not change the verbosity on a frosting project? – Nils Aug 20 '22 at 10:10
  • @Nils It doesn't change the verbosity for me. I didn't know what to expect. Given the solution below, I now know that the problem is on my side, so I will dig into it to find what I configured incorrectly. Thanks for confirming that for me. – lonix Aug 20 '22 at 10:58

2 Answers2

4

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;
Pascal Berger
  • 4,262
  • 2
  • 30
  • 54
  • The problem is obviously a configuration issue on my side. But at least the frosting project has a canonical verbosity answer now. Thanks Pascal! – lonix Aug 20 '22 at 11:02
1

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

Nils
  • 9,682
  • 6
  • 46
  • 72
  • That was it! You helped me track down my config issue. Your and Pascal's answers are very helpful for frosting verbosity, I'm sure it'll help others too. Thank you. – lonix Aug 21 '22 at 01:52