Browse Source

[Logs] Added a ResultStatus; Added convenience method to log exceptions

feature/authentication-tests
Robin Thoni 9 years ago
parent
commit
084b8b8277
2 changed files with 21 additions and 1 deletions
  1. 6
    1
      Logs/DBO/ResultStatus.cs
  2. 15
    0
      Logs/DataAccess/Logger.cs

+ 6
- 1
Logs/DBO/ResultStatus.cs View File

@@ -34,6 +34,11 @@ namespace iiie.Logs.DBO
34 34
         /// <summary>
35 35
         /// Ressource not found
36 36
         /// </summary>
37
-        NotFound
37
+        NotFound,
38
+
39
+        /// <summary>
40
+        /// Not handled error
41
+        /// </summary>
42
+        InternalError
38 43
     }
39 44
 }

+ 15
- 0
Logs/DataAccess/Logger.cs View File

@@ -65,6 +65,21 @@ namespace iiie.Logs.DataAccess
65 65
             }
66 66
         }
67 67
 
68
+        /// <summary>
69
+        /// Log an exception
70
+        /// </summary>
71
+        /// <param name="e">The exception to be logged</param>
72
+        public static void Log(Exception e)
73
+        {
74
+            LogOpResult(OpResult<int>.Error(ResultStatus.InternalError, e));
75
+        }
76
+
77
+        /// <summary>
78
+        /// Log an OpResult
79
+        /// </summary>
80
+        /// <typeparam name="T">User data type</typeparam>
81
+        /// <param name="result">The result to be logged</param>
82
+        /// <returns>The OpResult</returns>
68 83
         public static OpResult<T> LogOpResult<T>(OpResult<T> result)
69 84
         {
70 85
             string message = "Location:\n";

Loading…
Cancel
Save