Open Bug 1793870 Opened 2 years ago Updated 2 years ago

Rename maxLogLevel to minLogLevel in ConsoleInstanceOptions

Categories

(DevTools :: Console, task)

task

Tracking

(Not tracked)

People

(Reporter: jteow, Unassigned)

References

Details

The list of levels in LOG_LEVELS in Console.jsm goes from lowest number as the least restrictive (show all logs regardless of level) to the highest number as the most restrictive (don't show any logs). Important cases like error and warn are higher numbers.

The function shouldLog() uses aMaxLevel to compare against a message, whereby if the log level of the message is higher than or equal to aMaxLevel, the function returns true. In Console.jsm it uses this.maxLogLevel, the max log level set upon construction, as the argument aMaxLevel.

maxLogLevel is a bit of a misnomer, as it is more like the minimum log level that should be used. Providing the "max" implies that the value should not be exceeded. If one were to construct an instance of ConsoleAPI with warn (which has the value of 4) as the param value for maxLogLevel, then it's not Number.MIN_VALUE to 4 that would get included (as the name would suggest), it would actually be 4 to Number.MAX_VALUE.

See Also: → 1430810

As we're likely to remove Console.sys.mjs, retitling this to apply to ConsoleInstanceOptions as I think it possibly applies there as well.

Summary: Rename maxLogLevel to minLogLevel in Console.jsm → Rename maxLogLevel to minLogLevel in ConsoleInstanceOptions
You need to log in before you can comment on or make changes to this bug.