Change color acording to the level#980
Conversation
shargon
commented
Aug 1, 2019

Codecov Report
@@ Coverage Diff @@
## master #980 +/- ##
==========================================
+ Coverage 53.77% 53.83% +0.05%
==========================================
Files 194 195 +1
Lines 13251 13275 +24
==========================================
+ Hits 7126 7146 +20
- Misses 6125 6129 +4
Continue to review full report at Codecov.
|
|
We should define the colors, feel free to change it |
|
Looks good to me, @shargon. You are an artist. |
neo/Consensus/ConsensusService.cs
Outdated
| Console.WriteLine($"[{DateTime.Now.TimeOfDay:hh\\:mm\\:ss\\.fff}] {message}"); | ||
| Plugin.Log(nameof(ConsensusService), level, message); | ||
|
|
||
| currentColor.Apply(); |
There was a problem hiding this comment.
@shargon, this way all the time we are going to set the log? In every message?
There was a problem hiding this comment.
We need to back to the previous color
There was a problem hiding this comment.
Onh man...But there is an other solution @igormcoelho
There was a problem hiding this comment.
This is good Vitor... it's just stream set/unset, it's bullet fast.
neo/Consensus/ConsensusService.cs
Outdated
|
|
||
| private void Log(string message, LogLevel level = LogLevel.Info) | ||
| { | ||
| var currentColor = new ConsoleColorSet(); |
There was a problem hiding this comment.
Only thing I don't like here is this Dynamic memory criation for object... couldn't this all be static? it's such a simple thing...
There was a problem hiding this comment.
If you want, we could store the initial color in a static var
|
@igormcoelho When |
|
I mean, instead of creating a |
igormcoelho
left a comment
There was a problem hiding this comment.
Ok, now I got the need for going back to previous color...
Just beware that perhaps multi-threading here may mix all colors, I don't know if it may happen.
|
Can we move this to a plugin? |
|
I think that the logic affected is here, in |
|
I mean, move all the log related stuff to the plugin. |
|
Take a look at neo-project/neo-modules#112, i will change this for remove the Console.Write |
|
Problems with CRLF |