diff --git a/Doorstop b/Doorstop
index 92212e73..0a350fe8 160000
--- a/Doorstop
+++ b/Doorstop
@@ -1 +1 @@
-Subproject commit 92212e7366e1a225ae207edb377109d58d7dea68
+Subproject commit 0a350fe8a9792cd6708f5d5e805d82ec115c5e7d
diff --git a/IPA.Loader/Logging/Logger.cs b/IPA.Loader/Logging/Logger.cs
index 88bf432c..5bd74266 100644
--- a/IPA.Loader/Logging/Logger.cs
+++ b/IPA.Loader/Logging/Logger.cs
@@ -119,8 +119,8 @@ namespace IPA.Logging
/// A basic log function taking an exception to log.
///
/// the level of the message
- /// the exception to log
- public virtual void Log(Level level, Exception exeption) => Log(level, exeption.ToString());
+ /// the exception to log
+ public virtual void Log(Level level, Exception e) => Log(level, e.ToString());
///
/// Sends a debug message.
/// Equivalent to Log(Level.Debug, message);
diff --git a/IPA.Loader/Logging/StandardLogger.cs b/IPA.Loader/Logging/StandardLogger.cs
index 8bbb869c..aa64f4d2 100644
--- a/IPA.Loader/Logging/StandardLogger.cs
+++ b/IPA.Loader/Logging/StandardLogger.cs
@@ -49,9 +49,9 @@ namespace IPA.Logging
/// All levels defined by this filter will be sent to loggers. All others will be ignored.
///
public static LogLevel PrintFilter { get; set; }
- private List printers = new List(defaultPrinters);
+ private readonly List printers = new List(defaultPrinters);
- private Dictionary children = new Dictionary();
+ private readonly Dictionary children = new Dictionary();
static StandardLogger()
{
@@ -68,10 +68,10 @@ namespace IPA.Logging
new PluginSubLogPrinter(mainName, subName)
};
- if (_logThread == null || !_logThread.IsAlive)
+ if (logThread == null || !logThread.IsAlive)
{
- _logThread = new Thread(LogThread);
- _logThread.Start();
+ logThread = new Thread(LogThread);
+ logThread.Start();
}
}
@@ -81,22 +81,22 @@ namespace IPA.Logging
printers.Add(new PluginLogFilePrinter(name));
- if (_logThread == null || !_logThread.IsAlive)
+ if (logThread == null || !logThread.IsAlive)
{
- _logThread = new Thread(LogThread);
- _logThread.Start();
+ logThread = new Thread(LogThread);
+ logThread.Start();
}
}
internal StandardLogger GetChild(string name)
{
- if (!children.TryGetValue(name, out StandardLogger chld))
+ if (!children.TryGetValue(name, out var child))
{
- chld = new StandardLogger(logName, name, printers.ToArray());
- children.Add(name, chld);
+ child = new StandardLogger(logName, name, printers.ToArray());
+ children.Add(name, child);
}
- return chld;
+ return child;
}
///
@@ -115,7 +115,10 @@ namespace IPA.Logging
/// the message to log
public override void Log(Level level, string message)
{
- _logQueue.Add(new LogMessage
+ if (message == null)
+ throw new ArgumentNullException(nameof(message));
+
+ logQueue.Add(new LogMessage
{
Level = level,
Message = message,
@@ -132,9 +135,12 @@ namespace IPA.Logging
public override void Debug(string message)
{
// add source to message
- var stackFrame = new StackTrace().GetFrame(1).GetMethod();
+ var stackFrame = new StackTrace().GetFrame(1);
+ var method = stackFrame.GetMethod();
+ var lineNo = stackFrame.GetFileLineNumber();
+ var lineOffs = stackFrame.GetFileColumnNumber();
base.Debug(showSourceClass
- ? $"{{{stackFrame.DeclaringType?.FullName}::{stackFrame.Name}}} {message}"
+ ? $"{{{method.DeclaringType?.FullName}::{method.Name}({lineNo}:{lineOffs})}} {message}"
: message);
}
@@ -146,13 +152,13 @@ namespace IPA.Logging
public DateTime Time;
}
- private static BlockingCollection _logQueue = new BlockingCollection();
- private static Thread _logThread;
+ private static readonly BlockingCollection logQueue = new BlockingCollection();
+ private static Thread logThread;
private static void LogThread()
{
- HashSet started = new HashSet();
- while (_logQueue.TryTake(out LogMessage msg, Timeout.Infinite)) {
+ var started = new HashSet();
+ while (logQueue.TryTake(out var msg, Timeout.Infinite)) {
foreach (var printer in msg.Logger.printers)
{
try
@@ -170,11 +176,11 @@ namespace IPA.Logging
}
catch (Exception e)
{
- Console.WriteLine($"printer errored {e}");
+ Console.WriteLine($"printer errored: {e}");
}
}
- if (_logQueue.Count == 0)
+ if (logQueue.Count == 0)
{
foreach (var printer in started)
{
@@ -184,7 +190,7 @@ namespace IPA.Logging
}
catch (Exception e)
{
- Console.WriteLine($"printer errored {e}");
+ Console.WriteLine($"printer errored: {e}");
}
}
started.Clear();
@@ -194,8 +200,8 @@ namespace IPA.Logging
internal static void StopLogThread()
{
- _logQueue.CompleteAdding();
- _logThread.Join();
+ logQueue.CompleteAdding();
+ logThread.Join();
}
}
@@ -212,9 +218,9 @@ namespace IPA.Logging
/// the child logger
public static Logger GetChildLogger(this Logger logger, string name)
{
- if (logger is StandardLogger)
+ if (logger is StandardLogger standardLogger)
{
- return (logger as StandardLogger).GetChild(name);
+ return standardLogger.GetChild(name);
}
else
{
diff --git a/Refs/UnityEngine.CoreModule.dll b/Refs/UnityEngine.CoreModule.dll
index 44c7a2e8..9a6ebad5 100644
Binary files a/Refs/UnityEngine.CoreModule.dll and b/Refs/UnityEngine.CoreModule.dll differ