logger: Don't crash when not able to write to log

This commit is contained in:
Hylke Bons 2018-03-14 16:10:52 +00:00
parent f308216bbc
commit 62bcad5563

View file

@ -49,8 +49,14 @@ namespace Sparkles {
Console.WriteLine (line);
lock (log_writer_lock) {
log_writer.WriteLine (line);
log_writer.Flush ();
try {
log_writer.WriteLine (line);
log_writer.Flush ();
} catch (Exception e) {
Console.WriteLine (string.Format ("Could not write to log {0}: {1} {2}",
(log_writer.BaseStream as FileStream).Name, e.Message, e.StackTrace));
}
}
}