Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Fixed linux log module name
Browse files Browse the repository at this point in the history
  • Loading branch information
0blu committed Nov 25, 2022
1 parent 83993d9 commit 416af33
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions Framework/Logging/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -126,38 +127,8 @@ public static void outException(Exception err, [CallerMemberName] string method

private static string FormatCaller(string method, string path)
{
string location = path;

if (location.Contains("\\"))
{
string[] temp = location.Split('\\');
location = temp[temp.Length - 1].Replace(".cs", "");
}

return location.PadRight(15, ' ');
}

private static string NameOfCallingClass()
{
Type declaringType;

var fullName = string.Empty;
var skipFrames = 2;

do
{
var method = new StackFrame(skipFrames, false).GetMethod();

declaringType = method.DeclaringType;
if (declaringType == null)
return method.Name;

skipFrames++;
fullName = declaringType.Name;
}
while (declaringType.Module.Name.Equals("mscorlib.dll", StringComparison.OrdinalIgnoreCase));

return fullName;
var fileName = Path.GetFileNameWithoutExtension(path);
return fileName.PadRight(15, ' ');
}
}
}

0 comments on commit 416af33

Please sign in to comment.