Created
June 22, 2020 11:10
-
-
Save noseratio/bbc35b4e18250040a5ff4518d1b0d030 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
public static class Diags | |
{ | |
public static void Log( | |
string message, | |
[System.Runtime.CompilerServices.CallerMemberName] string callerName = "", | |
[System.Runtime.CompilerServices.CallerLineNumber] int lineNumber = 0, | |
[System.Runtime.CompilerServices.CallerFilePath] string filePath = "") | |
{ | |
// trim trailing new line characters | |
var trimmedMessage = message.TrimEnd(Environment.NewLine.ToCharArray()); | |
Debug.WriteLine(string.Format($"{filePath}({lineNumber}): {trimmedMessage}")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment