Update Cryville.Common.Logging.

This commit is contained in:
2023-11-20 20:21:21 +08:00
parent e2c58c708f
commit c2e94afc1c
24 changed files with 280 additions and 140 deletions

View File

@@ -1,4 +1,3 @@
using Cryville.Common.Logging;
using Cryville.Crtr.Extension;
using Mono.Cecil;
using System;
@@ -36,7 +35,7 @@ namespace Cryville.Crtr.Browsing {
modules.Enqueue(new ModuleItem(extension.OpenRead()));
}
catch (Exception ex) {
Logger.Log("main", 4, "Extension", "Failed to load DLL {0}: {1}", extension, ex);
Game.MainLogger.Log(4, "Extension", "Failed to load DLL {0}: {1}", extension, ex);
}
}
}
@@ -68,10 +67,10 @@ namespace Cryville.Crtr.Browsing {
LoadExtension(type);
}
}
Logger.Log("main", 1, "Extension", "Loaded module {0}", module.Definition.Name);
Game.MainLogger.Log(1, "Extension", "Loaded module {0}", module.Definition.Name);
}
catch (Exception ex) {
Logger.Log("main", 4, "Extension", "An error occurred while trying to load module {0}: {1}", module.Definition.Name, ex);
Game.MainLogger.Log(4, "Extension", "An error occurred while trying to load module {0}: {1}", module.Definition.Name, ex);
}
finally {
module.Definition.Dispose();
@@ -89,7 +88,7 @@ namespace Cryville.Crtr.Browsing {
missingList.Add(reference.Name);
}
}
Logger.Log("main", 4, "Extension", "Could not load the module {0} because the following dependencies were missing: {1}", module.Definition.Name, missingList.Aggregate((current, next) => current + ", " + next));
Game.MainLogger.Log(4, "Extension", "Could not load the module {0} because the following dependencies were missing: {1}", module.Definition.Name, missingList.Aggregate((current, next) => current + ", " + next));
module.Definition.Dispose();
module.Stream.Dispose();
}
@@ -128,10 +127,10 @@ namespace Cryville.Crtr.Browsing {
if (name != null && path != null) _localRes.Add(name, path);
}
}
Logger.Log("main", 1, "Extension", "Loaded extension {0}", type);
Game.MainLogger.Log(1, "Extension", "Loaded extension {0}", type);
}
catch (Exception ex) {
Logger.Log("main", 4, "Extension", "Failed to load extension {0}: {1}", type, ex);
Game.MainLogger.Log(4, "Extension", "Failed to load extension {0}: {1}", type, ex);
}
}
}