Opened 13 years ago

Closed 9 years ago

#9906 closed enhancement (wontfix)

Dojo Custom Logger

Reported by: Mike Wilcox Owned by: Mike Wilcox
Priority: high Milestone: future
Component: General Version: 1.3.2
Keywords: logger, debugger, Firebug Cc: cb1kenobi, James Burke
Blocked By: Blocking:


Attached is a prototype of the custom logger. The idea is that it provides custom calls other than "console.*". It is also designed to be modular with plugins. The default goes to Firebug, and included is a simple text logger. The idea is that Chris' Firebug Lite replacement would tie into this.

Still to be determined is if the build tool can strip custom logs. Also tbd is how this ties into base (as a require, or a script tag, or however)

Attachments (1) (3.5 KB) - added by Mike Wilcox 13 years ago.

Download all attachments as: .zip

Change History (6)

Changed 13 years ago by Mike Wilcox

Attachment: added

comment:1 Changed 13 years ago by cb1kenobi

Where does this get required? By Dojo base? By a custom debugger?

It doesn't appear to have any sort of message buffering system in the event this logger is loaded prior to a custom debugger being loaded. Log messages will be lost.

Calling "var log = dojox.logger.getLogger(...); log('blah');" may get to be a little verbose rather than console.log() or dojo.debug.log().

Perhaps dojo.debug should be a Firebug API compliant layer that implements this logger stuff, but also implements assert() and the rest of the API. Then custom debuggers just need to ask the dojo.debug log system for any buffered messages.

As for the log level, I was thinking that the custom debuggers could control which log messages would be displayed (i.e. toggle individual debug, log, info, warn, and error messages on/off).

Separate loggers for dojo and dijit is an interesting idea.

comment:2 Changed 13 years ago by Mike Wilcox

Message buffering is handled in cache. But as it stands now, being required after dojo.js loads, it wouldn't be able to log anything in Base.

I personally prefer getLogger() to make a nice compact log statement. dojo.debug.log() gets long, and we really need to think outside of console.

Currently there's no place for it to be required. I would like for it to work much like you pointed out as a djConfig setting. James is worried that this will break if the package is not included (say, just Base).

comment:3 Changed 13 years ago by James Burke

I prefer this not tie this into Base, for reasons milcox alluded to: if someone distributes a module that uses these custom log calls, things will break unless the logger is also shipped with the module *and* the consumer of the module also sets up the logger. Also, what if there are two competing loggers used by two different modules?

I prefer the modules that use some custom logging module explicitly dojo.require the custom logger's module. This will make the dependency much more explicit.

comment:4 Changed 13 years ago by Mike Wilcox

Milestone: tbdfuture

comment:5 Changed 9 years ago by Kitson Kelly

Resolution: wontfix
Status: newclosed

Closing this, because it is likely to take a different direction for Dojo 2.0, where logging and debugging will be addressed. Re-open if we will be doing anything with this ticket.

Note: See TracTickets for help on using tickets.