diff options
author | Teravus Ovares | 2008-02-05 02:10:01 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-05 02:10:01 +0000 |
commit | ba142c04108b4204df4f8c6dd1d9ee0546af0c87 (patch) | |
tree | 9f8f5c87e023bbed745880d53b66f74284c797cf /OpenSim | |
parent | * added missing project reference (diff) | |
download | opensim-SC-ba142c04108b4204df4f8c6dd1d9ee0546af0c87.zip opensim-SC-ba142c04108b4204df4f8c6dd1d9ee0546af0c87.tar.gz opensim-SC-ba142c04108b4204df4f8c6dd1d9ee0546af0c87.tar.bz2 opensim-SC-ba142c04108b4204df4f8c6dd1d9ee0546af0c87.tar.xz |
* Fixing the console write on shutdown where the object is already disposed.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Console/LogBase.cs | 109 |
1 files changed, 63 insertions, 46 deletions
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index f7d0d1f..a2c4b3a 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs | |||
@@ -232,68 +232,85 @@ namespace OpenSim.Framework.Console | |||
232 | 232 | ||
233 | private void WriteNewLine(ConsoleColor color, string format, params object[] args) | 233 | private void WriteNewLine(ConsoleColor color, string format, params object[] args) |
234 | { | 234 | { |
235 | lock (m_syncRoot) | 235 | try |
236 | { | 236 | { |
237 | string now = DateTime.Now.ToString("[MM-dd HH:mm:ss] "); | 237 | lock (m_syncRoot) |
238 | Log.Write(now); | ||
239 | try | ||
240 | { | 238 | { |
241 | Log.WriteLine(format, args); | 239 | string now = DateTime.Now.ToString("[MM-dd HH:mm:ss] "); |
242 | Log.Flush(); | 240 | Log.Write(now); |
243 | } | 241 | try |
242 | { | ||
243 | Log.WriteLine(format, args); | ||
244 | Log.Flush(); | ||
245 | } | ||
244 | 246 | ||
245 | catch (FormatException) | 247 | catch (FormatException) |
246 | { | 248 | { |
247 | System.Console.WriteLine(args); | 249 | System.Console.WriteLine(args); |
248 | } | 250 | } |
249 | System.Console.Write(now); | 251 | System.Console.Write(now); |
250 | try | 252 | try |
251 | { | 253 | { |
252 | if (color != ConsoleColor.White) | 254 | if (color != ConsoleColor.White) |
253 | System.Console.ForegroundColor = color; | 255 | System.Console.ForegroundColor = color; |
254 | 256 | ||
255 | System.Console.WriteLine(format, args); | 257 | System.Console.WriteLine(format, args); |
256 | System.Console.ResetColor(); | 258 | System.Console.ResetColor(); |
257 | } | 259 | } |
258 | catch (ArgumentNullException) | 260 | catch (ArgumentNullException) |
259 | { | 261 | { |
260 | // Some older systems dont support coloured text. | 262 | // Some older systems dont support coloured text. |
261 | System.Console.WriteLine(format, args); | 263 | System.Console.WriteLine(format, args); |
262 | } | 264 | } |
263 | catch (FormatException) | 265 | catch (FormatException) |
264 | { | 266 | { |
265 | // Some older systems dont support coloured text. | 267 | // Some older systems dont support coloured text. |
266 | System.Console.WriteLine(args); | 268 | System.Console.WriteLine(args); |
267 | } | 269 | } |
268 | 270 | ||
271 | return; | ||
272 | } | ||
273 | } | ||
274 | catch (ObjectDisposedException) | ||
275 | { | ||
269 | return; | 276 | return; |
270 | } | 277 | } |
271 | } | 278 | } |
272 | 279 | ||
273 | private void WritePrefixLine(ConsoleColor color, string sender) | 280 | private void WritePrefixLine(ConsoleColor color, string sender) |
274 | { | 281 | { |
275 | lock (m_syncRoot) | 282 | try |
276 | { | 283 | { |
277 | sender = sender.ToUpper(); | 284 | lock (m_syncRoot) |
278 | Log.WriteLine("[" + sender + "] "); | 285 | { |
279 | Log.Flush(); | 286 | sender = sender.ToUpper(); |
280 | 287 | ||
281 | System.Console.Write("["); | 288 | Log.WriteLine("[" + sender + "] "); |
282 | 289 | ||
283 | try | ||
284 | { | ||
285 | System.Console.ForegroundColor = color; | ||
286 | System.Console.Write(sender); | ||
287 | System.Console.ResetColor(); | ||
288 | } | ||
289 | catch (ArgumentNullException) | ||
290 | { | ||
291 | // Some older systems dont support coloured text. | ||
292 | System.Console.WriteLine(sender); | ||
293 | } | ||
294 | 290 | ||
295 | System.Console.Write("] \t"); | 291 | Log.Flush(); |
292 | |||
293 | System.Console.Write("["); | ||
296 | 294 | ||
295 | try | ||
296 | { | ||
297 | System.Console.ForegroundColor = color; | ||
298 | System.Console.Write(sender); | ||
299 | System.Console.ResetColor(); | ||
300 | } | ||
301 | catch (ArgumentNullException) | ||
302 | { | ||
303 | // Some older systems dont support coloured text. | ||
304 | System.Console.WriteLine(sender); | ||
305 | } | ||
306 | |||
307 | System.Console.Write("] \t"); | ||
308 | |||
309 | return; | ||
310 | } | ||
311 | } | ||
312 | catch (ObjectDisposedException) | ||
313 | { | ||
297 | return; | 314 | return; |
298 | } | 315 | } |
299 | } | 316 | } |