diff options
author | Sean Dague | 2008-02-14 19:29:07 +0000 |
---|---|---|
committer | Sean Dague | 2008-02-14 19:29:07 +0000 |
commit | 741f753c5642b382d759e1e732de3e22045b9b56 (patch) | |
tree | 214b8a9b9c86dd9f31a777c4952ddba4fbbbffc0 /OpenSim | |
parent | make dynamic textures temporary to try to stop filling up the (diff) | |
download | opensim-SC_OLD-741f753c5642b382d759e1e732de3e22045b9b56.zip opensim-SC_OLD-741f753c5642b382d759e1e732de3e22045b9b56.tar.gz opensim-SC_OLD-741f753c5642b382d759e1e732de3e22045b9b56.tar.bz2 opensim-SC_OLD-741f753c5642b382d759e1e732de3e22045b9b56.tar.xz |
attempt to make our logging at least fail gracefully, we'll see if this helps
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Console/OpenSimAppender.cs | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/OpenSim/Framework/Console/OpenSimAppender.cs b/OpenSim/Framework/Console/OpenSimAppender.cs index 1835d18..32eab11 100644 --- a/OpenSim/Framework/Console/OpenSimAppender.cs +++ b/OpenSim/Framework/Console/OpenSimAppender.cs | |||
@@ -14,37 +14,44 @@ namespace OpenSim.Framework.Console | |||
14 | { | 14 | { |
15 | override protected void Append(LoggingEvent le) | 15 | override protected void Append(LoggingEvent le) |
16 | { | 16 | { |
17 | string loggingMessage = RenderLoggingEvent(le); | 17 | try { |
18 | string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)"; | 18 | string loggingMessage = RenderLoggingEvent(le); |
19 | 19 | string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)"; | |
20 | Regex RE = new Regex(regex, RegexOptions.Multiline); | ||
21 | MatchCollection matches = RE.Matches(loggingMessage); | ||
22 | // Get some direct matches $1 $4 is a | ||
23 | if (matches.Count == 1) | ||
24 | { | ||
25 | System.Console.Write(matches[0].Groups["Front"].Value); | ||
26 | System.Console.Write("["); | ||
27 | |||
28 | WriteColorText(DeriveColor(matches[0].Groups["Category"].Value), matches[0].Groups["Category"].Value); | ||
29 | System.Console.Write("]:"); | ||
30 | 20 | ||
31 | if (le.Level == Level.Error) | 21 | |
32 | { | 22 | Regex RE = new Regex(regex, RegexOptions.Multiline); |
33 | WriteColorText(ConsoleColor.Red, matches[0].Groups["End"].Value); | 23 | MatchCollection matches = RE.Matches(loggingMessage); |
34 | } | 24 | // Get some direct matches $1 $4 is a |
35 | else if (le.Level == Level.Warn) | 25 | if (matches.Count == 1) |
36 | { | 26 | { |
37 | WriteColorText(ConsoleColor.Yellow, matches[0].Groups["End"].Value); | 27 | System.Console.Write(matches[0].Groups["Front"].Value); |
38 | } | 28 | System.Console.Write("["); |
39 | else | 29 | |
30 | WriteColorText(DeriveColor(matches[0].Groups["Category"].Value), matches[0].Groups["Category"].Value); | ||
31 | System.Console.Write("]:"); | ||
32 | |||
33 | if (le.Level == Level.Error) | ||
34 | { | ||
35 | WriteColorText(ConsoleColor.Red, matches[0].Groups["End"].Value); | ||
36 | } | ||
37 | else if (le.Level == Level.Warn) | ||
38 | { | ||
39 | WriteColorText(ConsoleColor.Yellow, matches[0].Groups["End"].Value); | ||
40 | } | ||
41 | else | ||
42 | { | ||
43 | System.Console.Write(matches[0].Groups["End"].Value); | ||
44 | } | ||
45 | System.Console.WriteLine(); | ||
46 | } | ||
47 | else | ||
40 | { | 48 | { |
41 | System.Console.Write(matches[0].Groups["End"].Value); | 49 | System.Console.Write(loggingMessage); |
42 | } | 50 | } |
43 | System.Console.WriteLine(); | 51 | } |
44 | } | 52 | catch (Exception e) |
45 | else | ||
46 | { | 53 | { |
47 | System.Console.Write(loggingMessage); | 54 | System.Console.WriteLine("Couldn't write out log message", e.ToString()); |
48 | } | 55 | } |
49 | } | 56 | } |
50 | 57 | ||