Page MenuHome

clog: Add color logging support for Windows Terminal
ClosedPublic

Authored by Ray molenkamp (LazyDodo) on Sep 9 2020, 3:51 PM.

Details

Summary

Windows terminal has support for the same color codes linux uses
to colorize the logs.

The only thing you need to check is if the WT_SESSION environment
variable is set to detect its presence.

The assumption that by default the console will support color in
CLG_ctx_init is unsafe (there is no way to tell what an OS not
supported by us may or may not support) and has been set to a
saner default.

Diff Detail

Repository
rB Blender
Branch
tmp_clog_color (branched from master)
Build Status
Buildable 10077
Build 10077: arc lint + arc unit

Event Timeline

Ray molenkamp (LazyDodo) requested review of this revision.Sep 9 2020, 3:51 PM
Ray molenkamp (LazyDodo) created this revision.
intern/clog/clog.c
561

It's a little comment heavy, i'm somewhat split on leaving the comment in code or moving it to the commit msg

Functionally this seems to work for me. Though I'm guessing the hardcoded terminal code inside ...\source\blender\gpu\opengl\gl_debug.cc will be handled separately?

Left is Windows Terminal, Right is cmd:


And yeah, the "INFO" text on the left is a different shade of white than the normal text so generally it is working.

Campbell Barton (campbellbarton) added inline comments.
intern/clog/clog.c
551

Capital L for Linux.

555–560

Benefits of BLI_getenv over getenv should be documented in BLI_getenv's docstring, this comment can just note that BLI_getenv advantages don't apply here.

This revision is now accepted and ready to land.Sep 10 2020, 10:12 AM

Functionally this seems to work for me. Though I'm guessing the hardcoded terminal code inside ...\source\blender\gpu\opengl\gl_debug.cc will be handled separately?

gl_debug.cc should probably just use clog rather than doing its own thing,, but that is out of scope for this diff cc: @Clément Foucault (fclem)