mirror of
https://github.com/LorenzCK/OnTopReplica.git
synced 2024-05-20 20:33:06 +12:00
Issue #60: fixed access to shared log file with multiple application instances.
This commit is contained in:
parent
076a8caf09
commit
8d68cab6ba
|
@ -18,11 +18,8 @@ namespace OnTopReplica {
|
||||||
Writer.AutoFlush = true;
|
Writer.AutoFlush = true;
|
||||||
}
|
}
|
||||||
catch (Exception) {
|
catch (Exception) {
|
||||||
|
//TODO: provide fallback logging mechanism?
|
||||||
Writer = null;
|
Writer = null;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
throw;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,11 +53,17 @@ namespace OnTopReplica {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteLine(string message) {
|
private static void WriteLine(string message) {
|
||||||
|
if (Writer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var s = string.Format("{0,-8:HH:mm:ss} {1}", DateTime.Now, message);
|
var s = string.Format("{0,-8:HH:mm:ss} {1}", DateTime.Now, message);
|
||||||
Writer.WriteLine(s);
|
Writer.WriteLine(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteLines(params string[] messages) {
|
private static void WriteLines(params string[] messages) {
|
||||||
|
if (Writer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (messages.Length > 0)
|
if (messages.Length > 0)
|
||||||
WriteLine(messages[0]);
|
WriteLine(messages[0]);
|
||||||
if (messages.Length > 1) {
|
if (messages.Length > 1) {
|
||||||
|
|
Loading…
Reference in a new issue