Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Cannot specify a log level from the CLI #142

Closed
NotMyself opened this issue Jul 21, 2016 · 11 comments
Closed

Cannot specify a log level from the CLI #142

NotMyself opened this issue Jul 21, 2016 · 11 comments

Comments

@NotMyself
Copy link

I am attempting to write an interactive tutorial and want to use dotnet-watch. I would like to suppress the info messages printed out by the watch command so that only messages from my tutorial are displayed.

I have tried adding a logging.json file, but it doesn't seem to be respected. The log level in the Tools project appears to be hard coded to info. How can I override it?

@victorhurdugaci
Copy link
Contributor

Agree, it would be a nice feature. It's a bit tricky to implement because we need a way to pass arguments to dotnet watch. Today, it just passes everything to dotnet. We'll definitely investigate this

@NotMyself
Copy link
Author

It might be as simple as looking for a logging.json so it can be configured externally.

@muratg
Copy link

muratg commented Jul 22, 2016

Assigning to @victorhurdugaci for invesigation in 1.1.0.

@victorhurdugaci
Copy link
Contributor

Hey @glennc, what do you think about this one?

@glennc
Copy link
Member

glennc commented Aug 30, 2016

hmmm. What are examples of the output that you want to suppress? Is it all output from watch?

I am thinking a switch passed to watch to stop it from logging anything. -[q]uite

@victorhurdugaci
Copy link
Contributor

Talked to @glennc offline. We'll make this configurable through and environment variable, just like we do for enabling the polling watcher.

@NotMyself
Copy link
Author

Here is an example from the DotNetCoreKoans project. The project is a teaching tool where the student is instructed to open the project in a text editor and then run dotnet watch run in their console. The student then changes code in a set of unit tests learning about the C# language. The output of the application guides them through each tutorial.

When running the application without the watcher, I have complete control over the output. With the watcher, it clutters up the output making it hard to follow.

At a minimum it would be nice to have the watcher respect a config file or a flag to specify silent output.

screen shot 2016-08-30 at 3 16 11 pm

@muratg
Copy link

muratg commented Aug 30, 2016

Would we be still displaying errors in "quiet" mode, and just be silent otherwise? Or completely silent?

@victorhurdugaci
Copy link
Contributor

The value you set in the env var will be the value from the LogLevel enum. If you set it to none nothing will be displayed while if you set it to error only error (and above) will be displayed. So, it's not a "quiet mode"

@victorhurdugaci
Copy link
Contributor

Hey @NotMyself , I added a new flag to allow you to turn off the log messages. See the updated readme for usage.

@natemcmaster
Copy link
Contributor

In #197, we added --verbose and --quiet options to dotnet-watch.

We also removed the env variable added in #155. It's worth noting that #197 also added support for the global dotnet-cli verbose flag (usage dotnet --verbose watch) which can also be set via the env variable DOTNET_CLI_CONTEXT_VERBOSE=true

@danroth27 danroth27 modified the milestones: 1.1.0-preview1, 1.0.0-preview3 Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants