-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Show log file path on benchmark finished #2964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: Show log file path on benchmark finished #2964
Conversation
3c13bae to
0f8e811
Compare
|
There appears to be a bit of overlap with |
|
I wonder if we should add a method to |
|
It would also be good to use this for |
ANSI escape sequence is not correctly shown when written to non-console logger.
As described above. I want to use this feature with custom TeraminalLogger/QuietLogger.
|
Non-console loggers would implement the link as they see fit. You'd just pass the raw link, not the escape sequence. |
|
I've tried to extend ILogger interface. So I wish to keep existing implementation direction.
I've confirmed TaskbarProgress API. Additionally, I've removed code that output link with |
|
What about add a new |
I've modified following codes at 956d44c
|
|
I was thinking more like: public interface ILinkLogger : ILogger
{
void WriteLink(string link, string? linkCaption = null, LogKind logKind = LogKind.Info);
}
public static class ILoggerExtensions
{
public void WriteLink(this ILogger logger, string link, string? linkCaption = null, LogKind logKind = LogKind.Info)
=> logger is ILinkLogger linkLogger
? linkLogger.WriteLink(link, linkCaption, logKind)
: logger.Write(logKind, link);
}And We don't need prefix and suffix because you can just use
|
|
I've updated code based on review comment.
It's required for temporary workaround for Windows Terminal inside helper method.
|
|
I'm not concerned about race conditions. Loggers are already assumed to not be thread-safe. In the one place we do parallel processing (builds), we use I don't like the new interface just being a marker. I feel like you ignored my comment
|
9891df6 to
19c8f03
Compare
I've removed related doc comment on latest commit.
And currently ILinkLogger is just be used as marker interface to distinguish logger that support ANSI escape sequence and OSC8. |
|
That doesn't make sense, why would you use separate marker interfaces for every implementation? If you put the method on the interface only 1 interface is needed; the console logger can implement it with escape sequence, and VS test logger can implement it with the file prefix. The extension exists simply to simulate DIM for old runtimes. |
Ignore above my comment. My original intent was that if new type of It can be avoided when using |
That's what the extension is supposed to do, simulate DIM (if the logger doesn't implement
It is expected to be implemented, though? You just gave an example of console logger and VS test logger needing different implementations. Custom user loggers could also have different implementations that we don't know about. |
Currently ArtifactsDirectory and generated log file path is not shown on console.
And it need to find log files from
bin\Debug\net8.0\BenchmarkDotNet.Artifacts.This PR add feature to show following paths as clickable link when benchmark finished.
ArtifactsDirectoryLogFilePathThis behavior is skipped when
--disableLogFileis passed.Sample Image

What's Changed in this PR
Helpers/ConsoleHelper.csto output clickable link by using ANSI Escape Sequence OSC8.When stdout is redirected or terminal don't support OSC8. It write URL as plain text.
Helpers/PathHelper.csto gets relative path. (It's required becausenetstandard2.0don't supportPath.GetRelativePath)CompositeLogger.csand add code to get ConsoleLogger-like logger.BenchmarkRunnerClean.csand add code to output clickable links.Helpers/PathHelperTests.csunit tests forPathHelper.GetRelativePath.Other Changes
ConfigParser.csto suppress exception thrown when running on VS TestExplorer.BenchmarkRunnerClean.csand insert empty line afterGlobal total time.