Ticket #273 (assigned defect)

Opened 10 months ago

Last modified 2 months ago

Possible problem with baseLog/LogLevel/messageLevel

Reported by: shaggymoose@gmail.com Assigned to: cederberg@gmail.com (accepted)
Priority: normal Milestone: MochiKit 1.4
Component: component1 Version:
Severity: normal Keywords: Logging
Cc:

Description

I was making a call to MochiKit.Logging.Logger.baseLog, using MochiKit.Logging.LogLevel?.* to specify the log level. Once this call reaches the function MochiKit.LoggingPane?.LoggingPane?.messageLevel, there is a problem mapping the LogLevel? constant to a useable value.

var messageLevel = function (msg) {
        var level = msg.level;
        if (typeof(level) == "number") {
            level = MochiKit.Logging.LogLevel[level];
        }
        return level;
    };

Here, it seems that if the provided log level is a number, it should be mapped to the corresponding text log level. However, this does not work. The variable "level" is set to undefined and the message is dropped.

I notice that internally, the log levels for the logging functions are set using a string literal and do not refer to LogLevel?. I am now doing the same, but it seems like the LogLevel? constants should be mapped correctly if used.

Change History

05/19/08 12:51:22 changed by cederberg@gmail.com

  • owner changed from somebody to cederberg@gmail.com.
  • status changed from new to assigned.
  • milestone set to MochiKit 1.4.

Excellent bug report. This is indeed an issue. The mapping from number to string must be done with a loop.