aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2020-01-13 19:22:50 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2020-01-13 19:22:50 +0200
commitabd9951fb899fcaaba8235ec92088f16d10e3918 (patch)
treec2782956114543cb9536d65ca82342a117686395 /Software/Visual_Studio/Tango.Logging
parent9f3968271713394e958ba4829c11014958be44dc (diff)
downloadTango-abd9951fb899fcaaba8235ec92088f16d10e3918.tar.gz
Tango-abd9951fb899fcaaba8235ec92088f16d10e3918.zip
Working on external bridge v2
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging')
-rw-r--r--Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs49
-rw-r--r--Software/Visual_Studio/Tango.Logging/LogManager.cs1
2 files changed, 14 insertions, 36 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs b/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
index 7c325ee19..dab06455c 100644
--- a/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
+++ b/Software/Visual_Studio/Tango.Logging/ExceptionLogItem.cs
@@ -13,50 +13,28 @@ 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; set; }
+ public Exception Exception
+ {
+ get { return _exception; }
+ set { _exception = value; }
+ }
/// <summary>
- /// Gets or sets the error description.
+ /// Gets the log message.
/// </summary>
- public String Description { get; set; }
+ public override string Message { get; set; }
/// <summary>
- /// Gets the log message.
+ /// Gets or sets the error description.
/// </summary>
- 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 { }
- }
+ public String Description { get; set; }
/// <summary>
/// Returns a formatted string of the log item.
@@ -65,6 +43,5 @@ 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);
}
-
}
}
diff --git a/Software/Visual_Studio/Tango.Logging/LogManager.cs b/Software/Visual_Studio/Tango.Logging/LogManager.cs
index 98bcaaa28..4f5bbb2ca 100644
--- a/Software/Visual_Studio/Tango.Logging/LogManager.cs
+++ b/Software/Visual_Studio/Tango.Logging/LogManager.cs
@@ -124,6 +124,7 @@ namespace Tango.Logging
log.Exception = e;
log.Category = category;
log.Description = description;
+ log.Message = log.Description + Environment.NewLine + log.Exception.FlattenException();
AppendLog(log);