Skip to content

Create FancyLogger opt-in/out mechanism#8178

Merged
JaynieBai merged 42 commits intodotnet:mainfrom
edvilme:edvilme-fancy-logger
Dec 20, 2022
Merged

Create FancyLogger opt-in/out mechanism#8178
JaynieBai merged 42 commits intodotnet:mainfrom
edvilme:edvilme-fancy-logger

Conversation

@edvilme
Copy link
Contributor

@edvilme edvilme commented Nov 17, 2022

Fixes #

Context

For the average user, the current ConsoleLogger does not provide the required amount of information about the build, as it either shows too little information (with low verbosity levels) or too much information that it is very difficult to find (with high verbosity levels).
A better approach would be having the log update to show the necessary amount of information for the current performing action (be it a project, target or task) and hiding additional data for actions that completed successfully; thus reducing the amount of irrelevant info.
Likewise the addition of formatting (bold, italics, color) using ANSI escape codes provides the user with a much better experience.
A progress tracker for the build is also considered.

This PR focuses only on the opt-in/out mechanism for the feature.

Changes Made

  • Created a new FancyLogger class.
  • Created a ANSIBuilder static class with helper methods for ANSI formatting and graphics
  • Added the /fancylogger and /flg command line switches for enabling the FancyLogger
  • Added the $MSBUILDFANCYLOGGER environment variable for enabling the FancyLogger

Testing

Notes

@edvilme edvilme changed the title Created FancyLogger (work in progress) Create FancyLogger (work in progress) Nov 17, 2022
@Forgind Forgind added the WIP label Nov 17, 2022
@edvilme edvilme force-pushed the edvilme-fancy-logger branch from e583016 to fc46e3f Compare November 18, 2022 21:58
Created class to encapsulate information and hierarchy of build events with their corresponding buffer line ids, and methods for expanding / collapsing (wip)
@edvilme edvilme changed the title Create FancyLogger (work in progress) Create FancyLogger opt-in/out mechanism Dec 6, 2022
@edvilme edvilme force-pushed the edvilme-fancy-logger branch from 2280a64 to 62da1ea Compare December 13, 2022 00:18
Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really, really want the deferred messages for details on why the new logger is not used despite the opt-in but would be ok with a follow-up PR adding that.

@edvilme edvilme removed the WIP label Dec 16, 2022
@edvilme
Copy link
Contributor Author

edvilme commented Dec 17, 2022

I really, really want the deferred messages for details on why the new logger is not used despite the opt-in but would be ok with a follow-up PR adding that.

It is added now :D

Copy link
Contributor

@Forgind Forgind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should get rid of testing.txt, but this looks pretty good to me overall, minus stylistic nits 🙂

@@ -0,0 +1,221 @@
using System;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copyright

if (FancyLoggerBuffer.AutoScrollEnabled) break;
}
FancyLoggerBuffer.Terminate();
Console.WriteLine("Build status, warnings and errors will be shown here after the build has ended and the interactive logger has closed");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should be localized eventually ™️

AutoScrollEnabled = true;
// Render contents
WriteTitleBar();
WriteFooter("This is an empty footer haha");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WriteFooter("This is an empty footer haha");
WriteFooter("This is an empty footer hoho");

Gotta get in the Christmas spirit!

#region Writing
public static void WriteTitleBar()
{
Console.Write(""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have to start there with "" + ? Could you just start with ANSIBuilder.Cursor.Home()?

new ParameterlessSwitchInfo( new string[] { "filelogger8", "fl8" }, ParameterlessSwitch.FileLogger8, null),
new ParameterlessSwitchInfo( new string[] { "filelogger9", "fl9" }, ParameterlessSwitch.FileLogger9, null),
new ParameterlessSwitchInfo( new string[] { "distributedfilelogger", "dfl" }, ParameterlessSwitch.DistributedFileLogger, null),
new ParameterlessSwitchInfo( new string[] { "fancylogger", "flg" }, ParameterlessSwitch.FancyLogger, null),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to make this a True/False thing so we can switch the default opt in/opt out behavior at some point?

@edvilme edvilme added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Dec 20, 2022
@JaynieBai JaynieBai merged commit a6f6699 into dotnet:main Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants