aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-12 14:03:47 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-12 14:03:47 +0300
commit856a23723afcc9d48c0f019dc33a259ac6c279ed (patch)
tree6cc82030ee2d9c74bd7f841bfdc6a0c163def97d /Software/Visual_Studio/Tango.Logging
parent70fe7f13b519df86420f8c2b97cf8eb3ab67e9a5 (diff)
downloadTango-856a23723afcc9d48c0f019dc33a259ac6c279ed.tar.gz
Tango-856a23723afcc9d48c0f019dc33a259ac6c279ed.zip
Implemented continuous request timeouts.
Implemented continuous request abort exception. Added log object for real time logs. Some work on PPC & Machine Studio.
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging')
-rw-r--r--Software/Visual_Studio/Tango.Logging/LogItemBase.cs5
-rw-r--r--Software/Visual_Studio/Tango.Logging/LogManager.cs16
2 files changed, 18 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/LogItemBase.cs b/Software/Visual_Studio/Tango.Logging/LogItemBase.cs
index 333b251d1..532737bbd 100644
--- a/Software/Visual_Studio/Tango.Logging/LogItemBase.cs
+++ b/Software/Visual_Studio/Tango.Logging/LogItemBase.cs
@@ -15,6 +15,11 @@ namespace Tango.Logging
private static String base_path;
/// <summary>
+ /// Gets or sets an optional log object.
+ /// </summary>
+ public Object LogObject { get; set; }
+
+ /// <summary>
/// Gets or sets the caller method adding the exception.
/// </summary>
public String CallerMethodName { get; set; }
diff --git a/Software/Visual_Studio/Tango.Logging/LogManager.cs b/Software/Visual_Studio/Tango.Logging/LogManager.cs
index 673b37cb6..5badff595 100644
--- a/Software/Visual_Studio/Tango.Logging/LogManager.cs
+++ b/Software/Visual_Studio/Tango.Logging/LogManager.cs
@@ -159,7 +159,7 @@ namespace Tango.Logging
/// <param name="message">Message.</param>
public String LogFormat(String message, object argument, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0)
{
- return Log(String.Format(message, argument), LogCategory.Info, caller, file, lineNumber);
+ return Log(String.Format(message, argument), LogCategory.Info, null, caller, file, lineNumber);
}
/// <summary>
@@ -168,7 +168,7 @@ namespace Tango.Logging
/// <param name="message">Message.</param>
public String Log(String message, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0)
{
- return Log(message, LogCategory.Info, caller, file, lineNumber);
+ return Log(message, LogCategory.Info, null, caller, file, lineNumber);
}
/// <summary>
@@ -177,6 +177,15 @@ namespace Tango.Logging
/// <param name="message">Message.</param>
public String Log(String message, LogCategory category, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0)
{
+ return Log(message, category, null, caller, file, lineNumber);
+ }
+
+ /// <summary>
+ /// Add new message log item.
+ /// </summary>
+ /// <param name="message">Message.</param>
+ public String Log(String message, LogCategory category, Object logObject, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0)
+ {
if (!Categories.Contains(category)) return message;
MessageLogItem log = new MessageLogItem();
@@ -186,6 +195,7 @@ namespace Tango.Logging
log.TimeStamp = DateTime.Now;
log.Category = category;
log.Message = message;
+ log.LogObject = logObject;
if (!OverrideQueue)
{
@@ -216,7 +226,7 @@ namespace Tango.Logging
private void AppendLog(LogItemBase log)
{
if (log != null)
- {
+ {
_loggers.Where(x => x.Enabled && x.Immediate).ToList().ForEach(x => x.OnLog(log));
}