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
         {
18
         {
19
             Logger.Error<int>(ResultStatus.DBError, "my private data", "my public data");
19
             Logger.Error<int>(ResultStatus.DBError, "my private data", "my public data");
20
             Logger.Error<int>(ResultStatus.DBError, "my private/public data", "");
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
             var value = "value";
22
             var value = "value";
23
             if (OpResult<int>.Ok(42))
23
             if (OpResult<int>.Ok(42))
24
                 value += " ok";
24
                 value += " ok";

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

121
         {
121
         {
122
             return LogOpResult(OpResult<T>.Error(status, e, userDetails));
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