Ticket #2527846 (accepted enhancement)

Reporter


Satyam
Opened: 04/12/09
Last modified: 04/26/11
Status: accepted
Type: enhancement

Owner


Dav Glass
Target Release: FUTURE
Priority: P3 (normal)
Summary: Add method logIf
Description:

Sometimes you want to log a message is certain condition is met. Like:

if (<condition>) Y.log('something');

In the minified version, the code ends up:

if(<condition>){}

A logIf method could be used:

Y.logIf(<condition>,'something');

and then have the whole stripped when creating the raw version.

Type: enhancement Observed in Version: 3.0.0 PR2
Component: YUI Global Object Severity: S3 (normal)
Assigned To: Dav Glass Target Release: FUTURE
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: N/A
URL:
Test Information:

Change History

Luke Smith

YUI Contributor

Posted: 05/14/09
  • browser changed to N/A
  • component changed from Logger to YUI Global Object
  • milestone changed to FUTURE
  • owner changed from Adam Moore to Adam Moore
  • status changed from new to assigned

This sounds like a great extension. Since logging is initiated at the Y instance level, I'm moving this to YUI Global and reassigning. I'll let Adam make the decision as to whether it's a better fit for core or a separate optional module.

Adam Moore

YUI Contributor

Posted: 05/14/09
  • status changed from assigned to accepted

Good idea, and it would be a trivial method to add. But it isn't trivial to scrub out during the build process. The variations that might be supplied for the condition is likely to trip up the regexp we are using for this. And when the log stripper breaks, it generally breaks the file -- usually in a sinister, ugly, sneaky manner that could invalidate a release. I'll take a look at how we might make this safer.

Adam Moore

YUI Contributor

Posted: 07/7/09

A similar request against YUI2 puts this functionality into a stubbed out assert function, which I think is better than logIf: http://yuilibrary.com/projects/yui2/ticket/1959024

George

YUI Developer

Posted: 04/20/11

Dav Glass

Posted: 04/26/11
  • location changed to Library Code
  • status changed from assigned to accepted