aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Web/TangoWebApplication.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.Web/TangoWebApplication.cs')
-rw-r--r--Software/Visual_Studio/Tango.Web/TangoWebApplication.cs42
1 files changed, 42 insertions, 0 deletions
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!");
+ }
+ }
+ }
+}