Description:
Tweak Spy method.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -104,7 +104,7 | |||||
|
104 | var start_y = random_generator.Next(0, 50); |
|
104 | var start_y = random_generator.Next(0, 50); |
|
105 |
|
105 | ||
|
106 | Logging.Spy(start_x, nameof(start_x)); |
|
106 | Logging.Spy(start_x, nameof(start_x)); |
|
107 | Logging.Spy(new {start_x}); |
|
107 | Logging.Spy(new {start_x, start_y}); |
|
108 |
|
108 | ||
|
109 | int max_squares = (message.max_squares == 0) ? DEFAULT_SQUARES : message.max_squares; |
|
109 | int max_squares = (message.max_squares == 0) ? DEFAULT_SQUARES : message.max_squares; |
|
110 | int min_squares = (message.min_squares == null) ? DEFAULT_MIN_SQUARES : (int)message.min_squares; |
|
110 | int min_squares = (message.min_squares == null) ? DEFAULT_MIN_SQUARES : (int)message.min_squares; |
@@ -2,6 +2,8 | |||||
|
2 | using System; |
|
2 | using System; |
|
3 | using System.Collections.Generic; |
|
3 | using System.Collections.Generic; |
|
4 | using System.Runtime.CompilerServices; |
|
4 | using System.Runtime.CompilerServices; |
|
|
5 | using System.Reflection; | ||
|
|
6 | // using System.Linq; | ||
|
5 |
|
7 | ||
|
6 | /* Tiny log library inspired by Python's logging and Glögi. |
|
8 | /* Tiny log library inspired by Python's logging and Glögi. |
|
7 | */ |
|
9 | */ |
@@ -154,8 +156,20 | |||||
|
154 |
|
156 | ||
|
155 | ) where T : class |
|
157 | ) where T : class |
|
156 | { |
|
158 | { |
|
157 | string message = string.Format("{0} = {1}", |
|
159 | // var properties = typeof(T).GetProperties(); |
|
158 | value.ToString(), typeof(T).GetProperties()[0].ToString() ); |
|
160 | // string message = string.Format("{0} = {1}", |
|
|
161 | // value.ToString(), .ToString() ); | ||
|
|
162 | // var message = String.Join(", ", (object[])properties); | ||
|
|
163 | |||
|
|
164 | var properties = new List<string>(); | ||
|
|
165 | |||
|
|
166 | foreach (var property in typeof(T).GetProperties()) | ||
|
|
167 | { | ||
|
|
168 | properties.Add(property.ToString() + "=" + property.GetValue(value)); | ||
|
|
169 | } | ||
|
|
170 | |||
|
|
171 | var message = "{" + String.Join(", ", properties) + "}"; | ||
|
|
172 | |||
|
159 | Logging.Log_(LogLevel.Spy, message, lineNumber, caller, path); |
|
173 | Logging.Log_(LogLevel.Spy, message, lineNumber, caller, path); |
|
160 | } |
|
174 | } |
|
161 | } |
|
175 | } |
You need to be logged in to leave comments.
Login now