bosagora / agora

POC Node implementation for CoinNet
https://bosagora.io
MIT License
37 stars 22 forks source link

AgoraLayout: Change colors to be more gradual #3227

Closed Geod24 closed 2 years ago

Geod24 commented 2 years ago
Use a 'final switch' to ensure all cases are handled;
Make Fatal and Error red, freeing up magenta;
Make Debug magenta, and switch colors for trace (formerly Cyan)
and verbose (formerly Blue) so that the color scheme follows
the same order as the natural spectrum of visible light.

Piggybacking on this little test code:

Δ source/agora/utils/Log.d
       host: null,
    };

-    const before = GC.stats();
-    layout.format(event, dg);
-    const after = GC.stats();
-    assert(result == "2018-04-30 00:42:42,420 \u001b[33mWarn\u001b[0m [Barney] - Have you met Ted?");
-    assert(before == after);
+    // const before = GC.stats();
+    // layout.format(event, dg);
+    // const after = GC.stats();
+    // assert(result == "2018-04-30 00:42:42,420 \u001b[33mWarn\u001b[0m [Barney] - Have you met Ted?");
+    // assert(before == after);
+
+    import std.stdio;
+
+    for (size_t i; i < LogLevel.None; ++i)
+    {
+        result.length = 0;
+        assumeSafeAppend(result);
+        event.level = cast(LogLevel) i;
+        layout.format(event, dg);
+        writeln(result);
+    }
}

We had this before:

Screen Shot 2022-03-24 at 13 16 23

After this PR we'll have this:

Screen Shot 2022-03-24 at 13 16 07

If anyone has preference on another color scheme let me know. I was mostly bothered by Debug being hard to read on a regular terminal.

codecov[bot] commented 2 years ago

Codecov Report

Merging #3227 (a262676) into v0.x.x (52198f2) will increase coverage by 58.05%. The diff coverage is 41.66%.

@@             Coverage Diff             @@
##           v0.x.x    #3227       +/-   ##
===========================================
+ Coverage   29.46%   87.51%   +58.05%     
===========================================
  Files         265      166       -99     
  Lines       27046    16963    -10083     
===========================================
+ Hits         7970    14846     +6876     
+ Misses      19076     2117    -16959     
Flag Coverage Δ
integration 34.24% <41.66%> (+4.77%) :arrow_up:
unittests 87.42% <41.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
source/agora/utils/Log.d 62.26% <41.66%> (+18.62%) :arrow_up:
source/agora/common/VibeTask.d 0.00% <0.00%> (-86.67%) :arrow_down:
source/agora/common/FileBasedLock.d 0.00% <0.00%> (-72.73%) :arrow_down:
source/agora/network/RPC.d 1.51% <0.00%> (-59.85%) :arrow_down:
source/agora/network/VibeManager.d 1.42% <0.00%> (-44.29%) :arrow_down:
source/agora/node/Runner.d 0.00% <0.00%> (-42.23%) :arrow_down:
source/scpd/scp/SCPDriver.d 60.00% <0.00%> (-15.00%) :arrow_down:
source/agora/consensus/Quorum.d 97.09% <0.00%> (-0.28%) :arrow_down:
source/scpd/scp/SCP.d 100.00% <0.00%> (ø)
source/agora/crypto/Crc16.d 100.00% <0.00%> (ø)
... and 311 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 52198f2...a262676. Read the comment docs.