Browse Source

[Logs] Added log helper method for OpResult

develop
Robin Thoni 9 years ago
parent
commit
96e953dd35
2 changed files with 6 additions and 1 deletions
  1. 1
    1
      Logs-test/Controllers/ValuesController.cs
  2. 5
    0
      Logs/DataAccess/Logger.cs

+ 1
- 1
Logs-test/Controllers/ValuesController.cs View File

@@ -18,7 +18,7 @@ namespace Logs_test.Controllers
18 18
         {
19 19
             Logger.Error<int>(ResultStatus.DBError, "my private data", "my public data");
20 20
             Logger.Error<int>(ResultStatus.DBError, "my private/public data", "");
21
-            Logger.Error<int>(ResultStatus.DBError, "my private data");
21
+            OpResult<int>.Error(ResultStatus.DBError, "my private data").Log();
22 22
             var value = "value";
23 23
             if (OpResult<int>.Ok(42))
24 24
                 value += " ok";

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

@@ -121,5 +121,10 @@ namespace iiie.Logs.DataAccess
121 121
         {
122 122
             return LogOpResult(OpResult<T>.Error(status, e, userDetails));
123 123
         }
124
+
125
+        public static OpResult<T> Log<T>(this OpResult<T> res)
126
+        {
127
+            return LogOpResult(res);
128
+        }
124 129
     }
125 130
 }

Loading…
Cancel
Save