Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Last active January 13, 2018 21:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Static Using Example 1
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace staticUsingExample
{
public static class Logger
{
public static void Log(string message,
[CallerFilePath] string sourceFilePath = "",
[CallerLineNumber] int sourceLineNumber = 0,
[CallerMemberName] string callerMemberName = "")
{
Log($"[Message]: {message}; [Source File Path]: {sourceFilePath}; " +
$"[Source Line Number]: {sourceLineNumber}; [Caller Member Name]: {callerMemberName}; ");
}
[Conditional("DEBUG")]
public static void DebugLog(string message, [CallerMemberName] string callerMemberName = "")
{
Log($"[Message]: {message}; [Caller Member Name]: {callerMemberName};");
}
private static void Log(string message)
{
Debug.WriteLine(message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment