mirror of
https://github.com/jaquadro/NBTExplorer.git
synced 2025-01-09 17:36:25 +00:00
Make logging actually succeed
This commit is contained in:
parent
f3304f51a1
commit
6412629678
1 changed files with 7 additions and 2 deletions
|
@ -86,7 +86,12 @@ namespace NBTExplorer
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
using (var writer = new StreamWriter("NBTExplorer.error.log", true)) {
|
string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NBTExplorer");
|
||||||
|
if (!Directory.Exists(logDir))
|
||||||
|
Directory.CreateDirectory(logDir);
|
||||||
|
|
||||||
|
string logPath = Path.Combine(logDir, "error.log");
|
||||||
|
using (var writer = new StreamWriter(logPath, true)) {
|
||||||
writer.WriteLine("NBTExplorer Error Report");
|
writer.WriteLine("NBTExplorer Error Report");
|
||||||
writer.WriteLine(DateTime.Now);
|
writer.WriteLine(DateTime.Now);
|
||||||
writer.WriteLine("-------");
|
writer.WriteLine("-------");
|
||||||
|
@ -104,7 +109,7 @@ namespace NBTExplorer
|
||||||
}
|
}
|
||||||
|
|
||||||
errorText.AppendLine();
|
errorText.AppendLine();
|
||||||
errorText.AppendLine("Additional error detail has been written to NBTExplorer.error.log");
|
errorText.AppendLine("Additional error detail has been written to:\n" + logPath);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue