Skip to content

Commit 52894b5

Browse files
committed
[PH] Merge logging changes from mainline
1 parent fe37cf4 commit 52894b5

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/PHAPI/KoikatuAPIBase.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public KoikatuAPI()
6060

6161
EnableDebugLoggingSetting = Config.Bind("Debug", "Show debug messages", false, "Enables display of additional log messages when certain events are triggered within KKAPI. Useful for plugin devs to understand when controller messages are fired. Changes take effect after game restart.");
6262

63-
Logger.LogDebug($"Game version {GetGameVersion()} running under {System.Threading.Thread.CurrentThread.CurrentCulture.Name} culture");
63+
Logger.LogDebug($"Game version {GetGameVersion()} running under {System.Threading.Thread.CurrentThread.CurrentCulture.Name} culture at UTC time {DateTime.UtcNow:yyyy/MM/dd HH:mm:ss}");
6464

6565
var abdata = Path.Combine(Paths.GameRootPath, "abdata");
6666
if (Directory.Exists(abdata))
@@ -80,6 +80,18 @@ public KoikatuAPI()
8080

8181
Logger.LogDebug($"Processor: {SystemInfo.processorType} ({SystemInfo.processorCount} threads @ {SystemInfo.processorFrequency}MHz); RAM: {SystemInfo.systemMemorySize}MB ({MemoryInfo.GetCurrentStatus()?.dwMemoryLoad.ToString() ?? "--"}% used); OS: {SystemInfo.operatingSystem}");
8282

83+
void PrintFileIfExists(string fileName)
84+
{
85+
var fullFilePath = Path.Combine(Paths.GameRootPath, fileName);
86+
if (File.Exists(fullFilePath))
87+
{
88+
var fileContents = File.ReadAllText(fullFilePath).Trim();
89+
if (!string.IsNullOrEmpty(fileContents))
90+
Logger.LogDebug($"Contents of the '{fileName}' file: {fileContents}");
91+
}
92+
}
93+
PrintFileIfExists(".doorstop_version");
94+
PrintFileIfExists("version");
8395
SceneManager.sceneLoaded += (scene, mode) => Logger.LogDebug($"SceneManager.sceneLoaded - {scene.name} in {mode} mode");
8496
SceneManager.sceneUnloaded += scene => Logger.LogDebug($"SceneManager.sceneUnloaded - {scene.name}");
8597
SceneManager.activeSceneChanged += (prev, next) => Logger.LogDebug($"SceneManager.activeSceneChanged - from {prev.name} to {next.name}");

0 commit comments

Comments
 (0)