comparison Implab/Diagnostics/TextFileListener.cs @ 47:b181f7bcb259 interactive logger

refactoring, interactive tarce log almost complete
author cin
date Thu, 17 Apr 2014 18:49:36 +0400
parents e5ec543feee3
children d9d794b61bb9
comparison
equal deleted inserted replaced
46:9ce97b262a7a 47:b181f7bcb259
21 msg.Append(" "); 21 msg.Append(" ");
22 msg.AppendFormat("[{0}]: {1}", context.ThreadId, text.content); 22 msg.AppendFormat("[{0}]: {1}", context.ThreadId, text.content);
23 23
24 lock (m_textWriter) { 24 lock (m_textWriter) {
25 if (!IsDisposed) { 25 if (!IsDisposed) {
26 // тут гарантировано еще не освобожден m_textWriter
26 m_textWriter.WriteLine(msg.ToString()); 27 m_textWriter.WriteLine(msg.ToString());
27 m_textWriter.Flush(); 28 m_textWriter.Flush();
28 } 29 }
29 } 30 }
30 } 31 }
31 32
32 33
33 protected override void Dispose(bool disposing) { 34 protected override void Dispose(bool disposing) {
34 base.Dispose(disposing); 35 base.Dispose(disposing);
35 if (disposing) { 36 if (disposing) {
37 // IsDisposed = true
36 lock (m_textWriter) { 38 lock (m_textWriter) {
37 Safe.Dispose(m_textWriter); 39 Safe.Dispose(m_textWriter);
38 } 40 }
39 } 41 }
40 } 42 }