47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
|
|
namespace Sarand.Net.Standard.Base.Utils
|
|
{
|
|
//=======================================================================
|
|
public static class LoggingUtils
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// M e t h o d N a m e
|
|
//-------------------------------------------------------------------
|
|
/*
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public static string GetMyMethodName ()
|
|
{
|
|
var st = new StackTrace(new StackFrame(1));
|
|
return st.GetFrame(0).GetMethod().Name;
|
|
}
|
|
*/
|
|
|
|
//-------------------------------------------------------------------
|
|
// L o g g i n g P r e f i x
|
|
//-------------------------------------------------------------------
|
|
/// <summary>
|
|
/// Format logging prefix from class and function names.
|
|
/// <para>'<class>.<function>'</para>
|
|
/// </summary>
|
|
public static String GetFn (this Object obj, String function)
|
|
{
|
|
return GetFn(obj.GetType(), function);
|
|
}
|
|
/// <summary>
|
|
/// Format logging prefix from class and function names.
|
|
/// <para>'<class>.<function>'</para>
|
|
/// </summary>
|
|
public static String GetFn (this Type type, String function)
|
|
{
|
|
return type.Name + "." + function;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|