Created
October 19, 2021 06:36
-
-
Save noseratio/09871682723e568d7b8abdcf0b75d220 to your computer and use it in GitHub Desktop.
Double-click the output in Visual Studio Output Window to go to that source file and line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal static partial class Diagnostics | |
{ | |
/// <summary> | |
/// Double-click the output in Visual Studio Output Window to go to that source file and line | |
/// </summary> | |
[Conditional("DEBUG")] | |
public static void Log( | |
string message, | |
[CallerMemberName] string callerName = "", | |
[CallerLineNumber] int lineNumber = 0, | |
[CallerFilePath] string filePath = "") | |
{ | |
// trim trailing new line characters | |
var trimmedMessage = message.TrimEnd(Environment.NewLine.ToCharArray()); | |
Debug.WriteLine($"{filePath}({lineNumber}): {trimmedMessage}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment