Closed Bug 971255 Opened 12 years ago Closed 12 years ago

[AccessFu] Make it easier to run code conditional on debug log level

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: eeejay, Assigned: eeejay)

Details

Attachments

(1 file, 1 obsolete file)

No description provided.
Why is this better than a simple if statement? Not sure.. maybe I like it becuase it encapsulates the logLevel a bit further..
Attachment #8374424 - Flags: review?(yzenevich)
Comment on attachment 8374424 [details] [diff] [review] [AccessFu] Introduce Logger.doIfDebug Review of attachment 8374424 [details] [diff] [review]: ----------------------------------------------------------------- It looks good, but since we always call Logger.debug inside Logger.doIfDebug, lets make Logger.debug do the check internally. We won't need doIfDebug at all in that case.
We already check the loglevel in debug(), the reason we still need to do it conditionally is because we making the strings to log is often not trivial, like accessibleToString, or other operations that we are only interested in performing when we are debugging, but not in production code.
Attachment #8374424 - Attachment is obsolete: true
Attachment #8374424 - Flags: review?(yzenevich)
Attachment #8375067 - Flags: review?(yzenevich)
Comment on attachment 8375067 [details] [diff] [review] [AccessFu] Allow providing a callable argument to Logger log calls. Review of attachment 8375067 [details] [diff] [review]: ----------------------------------------------------------------- awesome r=me with 1 nit. ::: accessible/src/jsat/Utils.jsm @@ +352,5 @@ > return; > > + let args = Array.prototype.slice.call(arguments, 1); > + let message = typeof(args[0]) === 'function' ? > + args[0]().join(' ') : args.join(' '); Nit: let message = (typeof(args[0]) === 'function' ? args[0]() : args[0]).join(' ');
Attachment #8375067 - Flags: review?(yzenevich) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: