diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Console/LogBase.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Framework/Console/LogBase.cs')
-rw-r--r-- | OpenSim/Framework/Console/LogBase.cs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index c976e2c..6651e5d 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs | |||
@@ -26,10 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Diagnostics; | ||
29 | using System.IO; | 31 | using System.IO; |
30 | using System.Net; | 32 | using System.Net; |
31 | using System.Diagnostics; | ||
32 | using System.Collections.Generic; | ||
33 | 33 | ||
34 | namespace OpenSim.Framework.Console | 34 | namespace OpenSim.Framework.Console |
35 | { | 35 | { |
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Console | |||
48 | { | 48 | { |
49 | private object m_syncRoot = new object(); | 49 | private object m_syncRoot = new object(); |
50 | 50 | ||
51 | StreamWriter Log; | 51 | private StreamWriter Log; |
52 | public conscmd_callback cmdparser; | 52 | public conscmd_callback cmdparser; |
53 | public string componentname; | 53 | public string componentname; |
54 | private bool m_verbose; | 54 | private bool m_verbose; |
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Console | |||
57 | { | 57 | { |
58 | this.componentname = componentname; | 58 | this.componentname = componentname; |
59 | this.cmdparser = cmdparser; | 59 | this.cmdparser = cmdparser; |
60 | this.m_verbose = verbose; | 60 | m_verbose = verbose; |
61 | System.Console.WriteLine("Creating new local console"); | 61 | System.Console.WriteLine("Creating new local console"); |
62 | 62 | ||
63 | if (String.IsNullOrEmpty(LogFile)) | 63 | if (String.IsNullOrEmpty(LogFile)) |
@@ -87,8 +87,8 @@ namespace OpenSim.Framework.Console | |||
87 | /// <returns>an ansii color</returns> | 87 | /// <returns>an ansii color</returns> |
88 | private ConsoleColor DeriveColor(string input) | 88 | private ConsoleColor DeriveColor(string input) |
89 | { | 89 | { |
90 | int colIdx = (input.ToUpper().GetHashCode() % 6) + 9; | 90 | int colIdx = (input.ToUpper().GetHashCode()%6) + 9; |
91 | return (ConsoleColor)colIdx; | 91 | return (ConsoleColor) colIdx; |
92 | } | 92 | } |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
@@ -236,7 +236,7 @@ namespace OpenSim.Framework.Console | |||
236 | { | 236 | { |
237 | lock (m_syncRoot) | 237 | lock (m_syncRoot) |
238 | { | 238 | { |
239 | string now = System.DateTime.Now.ToString("[MM-dd hh:mm:ss] "); | 239 | string now = DateTime.Now.ToString("[MM-dd hh:mm:ss] "); |
240 | Log.Write(now); | 240 | Log.Write(now); |
241 | Log.WriteLine(format, args); | 241 | Log.WriteLine(format, args); |
242 | Log.Flush(); | 242 | Log.Flush(); |
@@ -306,7 +306,7 @@ namespace OpenSim.Framework.Console | |||
306 | public int Read() | 306 | public int Read() |
307 | { | 307 | { |
308 | int TempInt = System.Console.Read(); | 308 | int TempInt = System.Console.Read(); |
309 | Log.Write((char)TempInt); | 309 | Log.Write((char) TempInt); |
310 | return TempInt; | 310 | return TempInt; |
311 | } | 311 | } |
312 | 312 | ||
@@ -359,7 +359,7 @@ namespace OpenSim.Framework.Console | |||
359 | { | 359 | { |
360 | // FIXME: Needs to be better abstracted | 360 | // FIXME: Needs to be better abstracted |
361 | Log.WriteLine(prompt); | 361 | Log.WriteLine(prompt); |
362 | this.Notice(prompt); | 362 | Notice(prompt); |
363 | ConsoleColor oldfg = System.Console.ForegroundColor; | 363 | ConsoleColor oldfg = System.Console.ForegroundColor; |
364 | System.Console.ForegroundColor = System.Console.BackgroundColor; | 364 | System.Console.ForegroundColor = System.Console.BackgroundColor; |
365 | string temp = System.Console.ReadLine(); | 365 | string temp = System.Console.ReadLine(); |
@@ -370,8 +370,8 @@ namespace OpenSim.Framework.Console | |||
370 | // Displays a command prompt and waits for the user to enter a string, then returns that string | 370 | // Displays a command prompt and waits for the user to enter a string, then returns that string |
371 | public string CmdPrompt(string prompt) | 371 | public string CmdPrompt(string prompt) |
372 | { | 372 | { |
373 | this.Notice(String.Format("{0}: ", prompt)); | 373 | Notice(String.Format("{0}: ", prompt)); |
374 | return this.ReadLine(); | 374 | return ReadLine(); |
375 | } | 375 | } |
376 | 376 | ||
377 | // Displays a command prompt and returns a default value if the user simply presses enter | 377 | // Displays a command prompt and returns a default value if the user simply presses enter |
@@ -423,8 +423,7 @@ namespace OpenSim.Framework.Console | |||
423 | 423 | ||
424 | public void MainLogPrompt() | 424 | public void MainLogPrompt() |
425 | { | 425 | { |
426 | 426 | string tempstr = CmdPrompt(componentname + "# "); | |
427 | string tempstr = this.CmdPrompt(this.componentname + "# "); | ||
428 | MainLogRunCommand(tempstr); | 427 | MainLogRunCommand(tempstr); |
429 | } | 428 | } |
430 | 429 | ||
@@ -436,7 +435,7 @@ namespace OpenSim.Framework.Console | |||
436 | Array.Reverse(tempstrarray); | 435 | Array.Reverse(tempstrarray); |
437 | Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); | 436 | Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); |
438 | Array.Reverse(tempstrarray); | 437 | Array.Reverse(tempstrarray); |
439 | string[] cmdparams = (string[])tempstrarray; | 438 | string[] cmdparams = (string[]) tempstrarray; |
440 | try | 439 | try |
441 | { | 440 | { |
442 | RunCmd(cmd, cmdparams); | 441 | RunCmd(cmd, cmdparams); |
@@ -454,7 +453,7 @@ namespace OpenSim.Framework.Console | |||
454 | string result = String.Empty; | 453 | string result = String.Empty; |
455 | 454 | ||
456 | string stacktrace = Environment.StackTrace; | 455 | string stacktrace = Environment.StackTrace; |
457 | List<string> lines = new List<string>(stacktrace.Split(new string[] { "at " }, StringSplitOptions.None)); | 456 | List<string> lines = new List<string>(stacktrace.Split(new string[] {"at "}, StringSplitOptions.None)); |
458 | 457 | ||
459 | if (lines.Count > 4) | 458 | if (lines.Count > 4) |
460 | { | 459 | { |
@@ -481,4 +480,4 @@ namespace OpenSim.Framework.Console | |||
481 | } | 480 | } |
482 | } | 481 | } |
483 | } | 482 | } |
484 | } | 483 | } \ No newline at end of file |