Open
Description
It would be really nice to be able to start a long run, and instead of getting a long scrolling list where most of the time I can't see what's executing, instead have an in-place display, updated appropriately and consisting of:
- Possibly the options involved (may be too long-winded)
- Current / total test count, e.g. "Running test 32/152"
- Name of currently running test
- Maybe the results of the previous test, for the sake of interest?
- Current execution time and estimated total time (or remaining time)
I don't know enough about the execution timing to know whether estimating the total remaining time is viable, but I suspect it is... we have a target time for each test, right?
Activity
jskeet commentedon May 25, 2016
I realize that a multi-line updating status box may be tricky - a weaker form of this feature request would be a mode which just says which test it's executing each time it starts a new one, along with the count, e.g. output of
Also, "quiet" may not be an ideal option name for this, as that would probably suggest even quieter output...
ig-sinicyn commentedon May 26, 2016
I've recently done something like this. The idea is borrowed from SynchronousProcessOutputLoggerWithDiagnoser.
There's HostLogger class that filters the output and prints only error messages and messages that starts with
// !
or// ?
.Also, all output between
"// !<--
and// !-->
lines is not filtered at all.Code
Tests
This approach works well for us, for example, output for the test simplifies up to:
(the log content starts after the
=============
line)mattwarren commentedon May 27, 2016
@ig-sinicyn would you be happy to submit a PR that adds
HostLogger.cs
to BenchmarkDotNet?It looks really nice and it would be good to have it available OOTB.
ig-sinicyn commentedon May 27, 2016
@mattwarren will do.
Any suggestions for prefixes / logger class name / constant names?
UPD: Note that the logger name will be widely used, example:
so it has to be short and obvious.
Also, I dislike the prefixes used to mark LogImportantAreaStart / End, but have no idea how to make it better.
Real-world example:
The log contains sections with xml that are parsed and used to adjust perftest limits. It allows to collect timings from another machines / CI build servers and annotate perftest code with these timings.
Here's the test that checks it. Note that the benchmark is automatically annotated with limits from the log.
ig-sinicyn commentedon May 27, 2016
@mattwarren
Well, the develop branch does not build at all, #187 .
You DEFINITELY need to setup an appveyor build:)
If this is urgent, feel free to copy the HostLogger' code by yourself.
adamsitnik commentedon May 27, 2016
@ig-sinicyn do you suffer from the same problems when trying to build from develop branch?
ig-sinicyn commentedon May 27, 2016
@adamsitnik yes, same issue here.
5 remaining items
vivekbm commentedon Apr 22, 2020
Hi @adamsitnik ,
Is this issue still open?
Regards,
Vivek M
adamsitnik commentedon Oct 14, 2022
Some hints for the potential contributor:
cd samples\BenchmarkDotNet.Samples\ dotnet run -c Release -f net6.0 --filter *IntroDisassembly.* --job dry
I am currently getting a lot of output:
Which could be minimized to:
The new option should be currently disabled by default. It should be possible to enable it via command line args, fluent API and an attribute. You can use
KeepFiles
as an example of similar boolean config switch, find all its usages in the code should show how to implement something very similar:https://github.com/dotnet/BenchmarkDotNet/blob/master/src/BenchmarkDotNet/Attributes/KeepBenchmarkFilesAttribute.cs
BenchmarkDotNet/src/BenchmarkDotNet/Configs/ConfigOptions.cs
Line 15 in 21a2940
BenchmarkDotNet/src/BenchmarkDotNet/Configs/ConfigExtensions.cs
Line 81 in 8ec00dd
I don't have any strong preferences for how it should be implemented. One way would be passing NullLogger instead of actual logger in some places in BDN. The simpler the solution, the better.
franciscomoloureiro commentedon Oct 15, 2022
I want to work on this issue
adamsitnik commentedon Oct 17, 2022
@franciscomoloureiro great, I've assigned you. Please let me know if you need help.
YegorStepanov commentedon Oct 18, 2022
Still verbose. We always have
log
file that we can open and see the logs. Console is a UI, not a log viewer.I would like to see the same
-verbosity
option asMSBuild
anddotnet cli
have:diag[nostic]
current output: full logs
d[etailed]
like Adam suggests
n[ormal]
It should not contain any debug/log information:
Also we can remove
remaining benchmarks
andtime to finish
because it already displays in console title #2140Detailed results
are often helpful? Maybe we can hide it too.Details
m[inimal]
Show table without 'legend'. The console will be nice and clean.
"legend"
does not give any information on the second day of using the BDN. But if you forgot, you can open the log file."Hints"
can be disabled viaConfig
Details
q[uiet]
No output
API example:
adamsitnik commentedon Oct 18, 2022
@YegorStepanov your proposal sounds very reasonable, I like it! @franciscomoloureiro if possible, please take it into consideration
YegorStepanov commentedon Nov 4, 2022
I'm thinking about the next
normal
verbosity level. I consider it as the default mode (at least in the future).Did I clean up more than necessary?
If you ok with this, then I will try to make
diagnostic
anddetailed
levels more consistent.P.S Each verbosity level contains all the information of the less verbose level. (
diagnostic
contains all message ofdetailed
, which contains all messages fromnormal
, etc)cc @AndreyAkinshin
eduherminio commentedon Sep 16, 2023
@franciscomoloureiro do you plan to continue with #2161 to try to address this?
tamirs9876 commentedon Dec 18, 2023
@franciscomoloureiro can you please share an update about the PR to address this issue?
JimmyCushnie commentedon Jun 8, 2025
It doesn't have all of the features mentioned in the OP, but I've written a logger with much less spammy output.
Code is here. Hopefully it's useful to someone :)
I'm afraid it's probably too messy to be integrated as-is with BenchmarkDotNet, but maybe we could use it as a basis for work on an official quiet logger. In particular, I figured out how to have the multiple persistent lines displaying status in a way that works (from my testing) across all different terminal environments and across different platforms. The only thing it doesn't handle well is if the terminal window is horizontally resized to be smaller while the program is running.
Before
ConsoleLogger.mp4
After
FocusLogger.mp4