Class: logger

dc. logger


new logger()

Provides basis logging and deprecation utilities

Source:
Returns:
Type
dc.logger

Members


enableDebugLog

Enable debug level logging. Set to false by default.

Source:

Methods


annotate( [fn] [, msg])

Used to provide an informational message for a function. It will return a wrapped version of the function, which will will issue a messsage with stack when invoked. The message will be issued only once.

Parameters:
Name Type Argument Description
fn function <optional>
msg String <optional>
Source:
Returns:
Type
function
Example
_chart.interpolate = dc.logger.annotate(function (interpolate) {
   if (!arguments.length) {
       return _interpolate;
   }
   _interpolate = interpolate;
   return _chart;
}, 'dc.lineChart.interpolate has been annotated since version 3.0 use dc.lineChart.curve instead');

debug( [msg])

Put a debug message to console. It is controlled by dc.logger.enableDebugLog

Parameters:
Name Type Argument Description
msg String <optional>
Source:
Returns:
Type
dc.logger
Example
dc.logger.debug('Total number of slices: ' + numSlices);

deprecate( [fn] [, msg])

Used to deprecate a function. It will return a wrapped version of the function, which will will issue a warning when invoked. The warning will be issued only once.

Parameters:
Name Type Argument Description
fn function <optional>
msg String <optional>
Source:
Returns:
Type
function
Example
_chart.interpolate = dc.logger.deprecate(function (interpolate) {
   if (!arguments.length) {
       return _interpolate;
   }
   _interpolate = interpolate;
   return _chart;
}, 'dc.lineChart.interpolate has been deprecated since version 3.0 use dc.lineChart.curve instead');

warn( [msg])

Put a warning message to console

Parameters:
Name Type Argument Description
msg String <optional>
Source:
Returns:
Type
dc.logger
Example
dc.logger.warn('Invalid use of .tension on CurveLinear');

warnOnce( [msg])

Put a warning message to console. It will warn only on unique messages.

Parameters:
Name Type Argument Description
msg String <optional>
Source:
Returns:
Type
dc.logger
Example
dc.logger.warnOnce('Invalid use of .tension on CurveLinear');