Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace: Change tr_debug color from gray to bright blue #14576

Merged
merged 1 commit into from
May 12, 2021
Merged

Trace: Change tr_debug color from gray to bright blue #14576

merged 1 commit into from
May 12, 2021

Conversation

marcuschangarm
Copy link
Contributor

Summary of changes

The gray-on-black color code used for debug level print-out in mbed_trace is hard to read.

mbed_trace_gray

Bright-blue-on-black increases the brightness of the text without over shadowing the info level default (white-on-black), thus making it easier to read while maintaining the original intention.

mbed_trace_bright_blue

Impact of changes

Migration actions required

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Apr 21, 2021
@ciarmcom
Copy link
Member

@marcuschangarm, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@Patater
Copy link
Contributor

Patater commented Apr 22, 2021

Does this still look alright for folks who use white or manila background terminals?

@Patater Patater self-assigned this Apr 22, 2021
@marcuschangarm
Copy link
Contributor Author

Hard to say how different terminals interpret the inversion. On mine, info's default color and debug's gray are hard to distinguish. Bright blue is still readable on white and it is less bright than info, as intended. Cyan on white is really hard to read though:

mbed_trace_gray_on_white

mbed_trace_bright_blue_on_white

@marcuschangarm
Copy link
Contributor Author

For comparison, here is normal blue on black and white:

mbed_trace_blue

mbed_trace_blue_on_white

Patater
Patater previously approved these changes Apr 23, 2021
Copy link
Contributor

@Patater Patater left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good improvement! Thanks!

@mergify mergify bot added needs: CI and removed needs: review labels Apr 23, 2021
0xc0170
0xc0170 previously approved these changes Apr 23, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 23, 2021

CI started

@mikter
Copy link

mikter commented Apr 23, 2021

This is just my opinion that this is not a right direction.

Debugs should be non intrusive and you should be able to look away from the terminal and doing other stuff and immediately when you see INFO traces you check what happened and notice that important event happened. then when the errors and warnings come you also immediately notice that your actions is required

This comes from our use case where we are doing interoperability events with other vendors where we organise test case between multiple other vendors and have multiple devices and Wireshark captures ongoing so multiple inputs that we need to follow.
Those noticeable info traces are the triggers that we follow and inform other parties that we are ready to move forward in test case

Errors and warnings are triggers for us to see that usually something is wrong with the test and it is going to fail and we need to start searching the problems using the debugs
so in this environment the Debugs are meaningless until something requires debugging when we need to then have those also available.

So this should be either be configurable (With all colors changed to accomodate different setup) and by default the non intrusiveness should be maintained Also runtime configuration would be ok to change the entire colour theme

@@ -52,7 +52,7 @@
#define VT100_COLOR_ERROR "\x1b[31m"
#define VT100_COLOR_WARN "\x1b[33m"
#define VT100_COLOR_INFO "\x1b[39m"
#define VT100_COLOR_DEBUG "\x1b[90m"
#define VT100_COLOR_DEBUG "\x1b[94m"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may end up into bikeshedding, but did you test with

#define VT100_COLOR_INFO  "\x1b[97m"
#define VT100_COLOR_DEBUG "\x1b[37m"

On my eye+terminal combo the end result was readable and it kept text in same color, just different brightness.

No matter what you choose here, someone will not like it. What if one just made these configurable and let one to choose correct colors at build time from their app config?

Copy link
Contributor

@kjbracey kjbracey Apr 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense in a trace-only world, but that part of the concept is that trace can be interleaved with standard non-trace application output (and maybe even command-line input). So that would mean "info trace" would be brighter than non-trace application output.

I guess you could set "bright white" after each trace line, rather than "default"?

@mbed-ci
Copy link

mbed-ci commented Apr 23, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@kjbracey
Copy link
Contributor

kjbracey commented Apr 23, 2021

Debugs should be non intrusive

I tend to agree with that, because there shouldn't normally be anything you care about in debug. I've said for a while the default output level shouldn't even include debug, and then when you do enable it, you often don't really want it to totally drown out the non-debug-level stuff.

Having it non-intrusive by default helps you just leave it enabled - you don't have to shut it off to see the main info clearly.

I vote for having a config option with a more "loud" output, including clearly visible debug, and possibly including the use of "bright white" that Tero suggested. (But make it just a simple "theme" total setting - per-colour setting would just be annoyingly fiddly).

In effect we do have 2 themes already - colour and no-colour. Maybe that can just be extended to a multiway option?

@marcuschangarm
Copy link
Contributor Author

I actually agree with some of the counter points here. Another problem I'm trying to solve here though, is that too often I get sent screenshots from customers with their trace output so having defaults that are readable, without any modifications, would be extremely helpful and save time from asking them for better traces.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 26, 2021

I vote for having a config option with a more "loud" output, including clearly visible debug, and possibly including the use of "bright white" that Tero suggested. (But make it just a simple "theme" total setting - per-colour setting would just be annoyingly fiddly).

@marcuschangarm to progress, shall we define these via config and keep the default values there?

@marcuschangarm
Copy link
Contributor Author

@0xc0170 keeping the current default values is not going to help me since I have no control over our customer's build and configurations. The whole point is to make it easier to help customers when they send us screen shots or when we have remote debugging sessions.

@kjbracey
Copy link
Contributor

I wouldn't be adverse to having the default option be a new, louder one, as long as it was easy to switch back to quiet debug for Mika's use case.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 27, 2021

I wouldn't be adverse to having the default option be a new, louder one, as long as it was easy to switch back to quiet debug for Mika's use case

I meant it this way as well, having the default values as they are here

@marcuschangarm
Copy link
Contributor Author

@kjbracey-arm @0xc0170

In that case, how about I

  • add four new macros to mbed_lib.json: MBED_TRACE_COLOR_[DEBUG,INFO,WARNING,ERROR]
  • make them integers instead of strings
  • do #ifndef in mbed_trace.c for the macros

?

@kjbracey
Copy link
Contributor

I don't think anyone really wants to mess with options for individual colours. No-one's that picky, and if they are they can do local edits. :) Plus it would require people to look up VT100 color codes.

My suggestion would be just to have a numbered color theme. Theme 0 = original, color theme 1 = this.

You you don't technically even need an ifdef because #if MBED_TRACE_COLOR_THEME == 0 is true if it's not defined.

That would let the C file retain original default behaviour, which I think is the right thing to do as it is used in some non-Mbed OS contexts.

But for Mbed OS we can have the JSON file default the Mbed OS option for theme to 1. Help text can list the codes - "0 = original (dark debug); 1 = more prominent blue debug".

Random thing that just occurred to me - why is "INFO" cyan in your screenshots? I can't see that in the source. Is that your terminal doing some parsing?

@marcuschangarm
Copy link
Contributor Author

That would let the C file retain original default behaviour, which I think is the right thing to do as it is used in some non-Mbed OS contexts.

It is for these non-Mbed customers I would like to have the #ifndefs. Having the default be the new bright color would also benefit these customer engagements.

Random thing that just occurred to me - why is "INFO" cyan in your screenshots? I can't see that in the source. Is that your terminal doing some parsing?

Yes, for some reason MobaTerm highlights success, fail, error, info in different colors.

@kjbracey
Copy link
Contributor

Okay, I don't have any particular issue with the default being different for non-Mbed OS. Is this the master repo for such use now? Who'd have say on that?

@marcuschangarm
Copy link
Contributor Author

Pelion uses this repo for non-mbed os builds: https://github.com/PelionIoT/mbed-trace but we probably don't want it to diverge from Mbed OS too much.

@0xc0170
Copy link
Contributor

0xc0170 commented May 3, 2021

What shall we do to fix the default color in Mbed OS? Introduce a new color theme as suggested and set as default for Mbed OS?

@mergify mergify bot dismissed stale reviews from Patater and 0xc0170 May 4, 2021 23:00

Pull request has been modified.

@@ -19,6 +19,12 @@
"value": "malloc",
"macro_name": "MEM_ALLOC"
},
"color-theme": {
"help": "Set color theme. NULL for bright, 1 for dark.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the choice of "null" and "1"? Why not "0" and "1"?

- "help": "Set color theme. NULL for bright, 1 for dark.",
+ "help": "Set color theme. 0 for readable, 1 for unobtrusive.",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just copying it from a different place. 0/1 sounds good as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

The gray-on-black color code used for debug level print-out in
mbed_trace is hard to read. Bright-blue-on-black increases the
brightness of the text without over shadowing the info level
default (white-on-black), thus making it easier to read while
maintaining the original intention.

For original color set MBED_TRACE_COLOR_THEME to 1.
@0xc0170
Copy link
Contributor

0xc0170 commented May 10, 2021

CI started

@mergify mergify bot added needs: CI and removed needs: review labels May 10, 2021
@mbed-ci
Copy link

mbed-ci commented May 10, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented May 11, 2021

CI restarted

@mbed-ci
Copy link

mbed-ci commented May 11, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 3 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 requested a review from Patater May 11, 2021 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants