aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs')
-rw-r--r--Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs49
1 files changed, 36 insertions, 13 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs b/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
index dab06455c..7c325ee19 100644
--- a/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
+++ b/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
@@ -13,28 +13,50 @@ namespace Tango.Logging
[Serializable]
public class ExceptionLogItem : LogItemBase
{
- private bool _messageSet;
-
- [NonSerialized]
- private Exception _exception;
/// <summary>
/// Gets or sets the log item exception.
/// </summary>
- public Exception Exception
- {
- get { return _exception; }
- set { _exception = value; }
- }
+ public Exception Exception { get; set; }
/// <summary>
- /// Gets the log message.
+ /// Gets or sets the error description.
/// </summary>
- public override string Message { get; set; }
+ public String Description { get; set; }
/// <summary>
- /// Gets or sets the error description.
+ /// Gets the log message.
/// </summary>
- public String Description { get; set; }
+ public override string Message
+ {
+ get
+ {
+ if (Exception is AggregateException)
+ {
+ try
+ {
+ String message = String.Empty;
+
+ if (Description != null)
+ {
+ message += Description + Environment.NewLine;
+ }
+
+ message += String.Join(Environment.NewLine, (Exception as AggregateException).InnerExceptions.Select(x => x.Message));
+
+ return message;
+ }
+ catch
+ {
+ return Exception.Message;
+ }
+ }
+ else
+ {
+ return Exception.Message;
+ }
+ }
+ set { }
+ }
/// <summary>
/// Returns a formatted string of the log item.
@@ -43,5 +65,6 @@ namespace Tango.Logging
{
return String.Format("[{0}] [{6}] [{1}] [{2}] [{3}]: {4}{5}", TimeStamp.ToString("HH:mm:ss.ff"), GetRelativeCallerFilePath(), CallerMethodName, CallerLineNumber, Description, Environment.NewLine + Exception.FlattenException(), Category);
}
+
}
}