aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2018-12-28 23:30:23 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2018-12-28 23:30:23 +0200
commit537212b4aa3419d75ce015e5aa3a455288dc430a (patch)
tree60779db3e7c42611219a6f858db54aa6450c6eb0 /Software/Visual_Studio
parent00de504d4d276063ec6b732cc95e476c89182df2 (diff)
downloadTango-537212b4aa3419d75ce015e5aa3a455288dc430a.tar.gz
Tango-537212b4aa3419d75ce015e5aa3a455288dc430a.zip
Implemented Azure Cloud Logger.
Implemented base class for global.asax
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnkbin1445 -> 1530 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnkbin1516 -> 1581 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnkbin1444 -> 1529 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnkbin1462 -> 1547 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Transport Router.lnkbin1493 -> 1578 bytes
-rw-r--r--Software/Visual_Studio/Tango.Web/Logging/AzureCloudLogger.cs56
-rw-r--r--Software/Visual_Studio/Tango.Web/Tango.Web.csproj2
-rw-r--r--Software/Visual_Studio/Tango.Web/TangoWebApplication.cs42
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Global.asax.cs29
9 files changed, 103 insertions, 26 deletions
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
index 7bbdf66b4..fd3743ce5 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
index 16360627d..a454f518f 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
index ab1bc5eed..ff739ffcb 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
index 5b8ad68a5..4115fb2ac 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
index febffabca..9294fa274 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Tango.Web/Logging/AzureCloudLogger.cs b/Software/Visual_Studio/Tango.Web/Logging/AzureCloudLogger.cs
new file mode 100644
index 000000000..8cdc21d20
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/Logging/AzureCloudLogger.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Logging;
+
+namespace Tango.Web.Logging
+{
+ /// <summary>
+ /// Represents an azure blob storage logger.
+ /// </summary>
+ /// <seealso cref="Tango.Logging.ILogger" />
+ public class AzureCloudLogger : ILogger
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AzureCloudLogger"/> class.
+ /// </summary>
+ public AzureCloudLogger()
+ {
+ Enabled = true;
+ }
+
+ /// <summary>
+ /// Called when a new log is available.
+ /// </summary>
+ /// <param name="log">The log.</param>
+ public void OnLog(LogItemBase log)
+ {
+ switch (log.Category)
+ {
+ case LogCategory.Info:
+ Trace.TraceInformation(log.ToString());
+ break;
+ case LogCategory.Warning:
+ Trace.TraceWarning(log.ToString());
+ break;
+ case LogCategory.Error:
+ Trace.TraceError(log.ToString());
+ break;
+ case LogCategory.Critical:
+ Trace.TraceError(log.ToString());
+ break;
+ case LogCategory.Debug:
+ Trace.WriteLine(log.ToString());
+ break;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this <see cref="T:Tango.Logging.ILogger" /> is enabled.
+ /// </summary>
+ public bool Enabled { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
index 70ac28e6e..0f04121d1 100644
--- a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
+++ b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
@@ -246,8 +246,10 @@
<Compile Include="ActiveDirectory\ActiveDirectoryManager.cs" />
<Compile Include="Authentication\TokensManager.cs" />
<Compile Include="DeploymentSlot.cs" />
+ <Compile Include="Logging\AzureCloudLogger.cs" />
<Compile Include="Storage\ExtensionMethods.cs" />
<Compile Include="Storage\StorageManager.cs" />
+ <Compile Include="TangoWebApplication.cs" />
<Compile Include="WebConfig.cs" />
<Compile Include="Controllers\JsonController.cs" />
<Compile Include="Formatters\JsonNetFormatter.cs" />
diff --git a/Software/Visual_Studio/Tango.Web/TangoWebApplication.cs b/Software/Visual_Studio/Tango.Web/TangoWebApplication.cs
new file mode 100644
index 000000000..c9fea1678
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/TangoWebApplication.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web;
+using System.Web.Http;
+using System.Web.Http.Filters;
+using System.Web.Mvc;
+using Tango.Logging;
+using Tango.Web.Logging;
+
+namespace Tango.Web
+{
+ public class TangoWebApplication : HttpApplication
+ {
+ //Create filter
+ public class LogExceptionFilterAttribute : ExceptionFilterAttribute
+ {
+ public override void OnException(HttpActionExecutedContext context)
+ {
+ ErrorLogService.LogError(context.Exception);
+ }
+ }
+
+ protected virtual void Application_Start()
+ {
+ LogManager.Default.RegisterLogger(new AzureCloudLogger());
+
+ GlobalConfiguration.Configuration.Filters.Add(new LogExceptionFilterAttribute());
+ }
+
+ //common service to be used for logging errors
+ public static class ErrorLogService
+ {
+ public static void LogError(Exception ex)
+ {
+ LogManager.Default.Log(ex, "Global Exception!");
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Global.asax.cs b/Software/Visual_Studio/Web/Tango.MachineService/Global.asax.cs
index ef698bb25..ef41ef3e7 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Global.asax.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Global.asax.cs
@@ -9,40 +9,17 @@ using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Tango.Logging;
+using Tango.Web;
namespace Tango.MachineService
{
- public class WebApiApplication : System.Web.HttpApplication
+ public class WebApiApplication : TangoWebApplication
{
- //Create filter
- public class LogExceptionFilterAttribute : ExceptionFilterAttribute
- {
- public override void OnException(HttpActionExecutedContext context)
- {
- ErrorLogService.LogError(context.Exception);
- }
- }
-
- protected void Application_Start()
+ protected override void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
-
- //LogManager.Default.RegisterLogger(new FileLogger());
- LogManager.Default.RegisterLogger(new VSOutputLogger("MachineService"));
-
- //register your filter with Web API pipeline
- GlobalConfiguration.Configuration.Filters.Add(new LogExceptionFilterAttribute());
- }
-
- //common service to be used for logging errors
- public static class ErrorLogService
- {
- public static void LogError(Exception ex)
- {
- LogManager.Default.Log(ex, "Global Exception!");
- }
}
}
}