Open Bug 1828395 Opened 2 years ago Updated 6 months ago

Remote Log.verbose getter returns true for the least verbose log levels

Categories

(Remote Protocol :: Agent, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned, Mentored)

References

Details

(Whiteboard: [lang=js])

The verbose getter in remote Log is

  static get verbose() {
    // we can't use Preferences.sys.mjs before first paint,
    // see ../browser/base/content/test/performance/browser_startup.js
    const level = Services.prefs.getStringPref(PREF_REMOTE_LOG_LEVEL, "Info");
    return StdLog.Level[level] >= StdLog.Level.Info;
  }

However, the way Log levels work is that the least verbose levels are assigned a higher number:

    Fatal: 70,
    Error: 60,
    Warn: 50,
    Info: 40,
    Config: 30,
    Debug: 20,
    Trace: 10,
    All: -1,

So this getter is true for Info, Warn, Error and Fatal (which are arguably not supposed to be verbose) and false for Config, Debug, Trace and All.

The getter is used to prettify JSON payloads in 2 spots:

In the second and third spot, this was actually never displayed, because the strings are only logged if the remote log level is debug or trace, for which the current Log.verbose would always return false.

In the first spot, it means our CDP JSON handler is returning a bigger payload unless the log level was Config or more verbose.

We might want to use a different preference for prettifying the JSON objects, as it can have a major impact on the log size.

Mentor: jdescottes
Priority: -- → P3
Whiteboard: [lang=js]

The severity field is not set for this bug.
:whimboo, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(hskupin)
Severity: -- → S3
Flags: needinfo?(hskupin)
See Also: → 1914469
You need to log in before you can comment on or make changes to this bug.