mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
fix stopwatch logging type
This commit is contained in:
@@ -30,7 +30,7 @@ namespace Wox.Infrastructure.Logger
|
|||||||
LogManager.Configuration = configuration;
|
LogManager.Configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string CallerType()
|
public static string CallerType()
|
||||||
{
|
{
|
||||||
var stackTrace = new StackTrace();
|
var stackTrace = new StackTrace();
|
||||||
var stackFrames = stackTrace.GetFrames().NonNull();
|
var stackFrames = stackTrace.GetFrames().NonNull();
|
||||||
@@ -79,22 +79,32 @@ namespace Wox.Infrastructure.Logger
|
|||||||
} while (e != null);
|
} while (e != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Debug(string msg)
|
public static void Debug(string type, string msg)
|
||||||
{
|
{
|
||||||
var type = CallerType();
|
|
||||||
var logger = LogManager.GetLogger(type);
|
var logger = LogManager.GetLogger(type);
|
||||||
System.Diagnostics.Debug.WriteLine($"DEBUG: {msg}");
|
System.Diagnostics.Debug.WriteLine($"DEBUG: {msg}");
|
||||||
logger.Debug(msg);
|
logger.Debug(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Info(string msg)
|
public static void Debug(string msg)
|
||||||
{
|
{
|
||||||
var type = CallerType();
|
var type = CallerType();
|
||||||
|
Debug(type, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Info(string type, string msg)
|
||||||
|
{
|
||||||
var logger = LogManager.GetLogger(type);
|
var logger = LogManager.GetLogger(type);
|
||||||
System.Diagnostics.Debug.WriteLine($"INFO: {msg}");
|
System.Diagnostics.Debug.WriteLine($"INFO: {msg}");
|
||||||
logger.Info(msg);
|
logger.Info(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Info(string msg)
|
||||||
|
{
|
||||||
|
var type = CallerType();
|
||||||
|
Info(type, msg);
|
||||||
|
}
|
||||||
|
|
||||||
public static void Warn(string msg)
|
public static void Warn(string msg)
|
||||||
{
|
{
|
||||||
var type = CallerType();
|
var type = CallerType();
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ namespace Wox.Infrastructure
|
|||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
var milliseconds = stopWatch.ElapsedMilliseconds;
|
var milliseconds = stopWatch.ElapsedMilliseconds;
|
||||||
string info = $"{name} : {milliseconds}ms";
|
string info = $"{name} : {milliseconds}ms";
|
||||||
Log.Debug(info);
|
var type = Log.CallerType();
|
||||||
|
Log.Debug(type, info);
|
||||||
return milliseconds;
|
return milliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +32,8 @@ namespace Wox.Infrastructure
|
|||||||
stopWatch.Stop();
|
stopWatch.Stop();
|
||||||
var milliseconds = stopWatch.ElapsedMilliseconds;
|
var milliseconds = stopWatch.ElapsedMilliseconds;
|
||||||
string info = $"{name} : {milliseconds}ms";
|
string info = $"{name} : {milliseconds}ms";
|
||||||
Log.Info(info);
|
var type = Log.CallerType();
|
||||||
|
Log.Info(type, info);
|
||||||
return milliseconds;
|
return milliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user