Skip to content

Latest commit

 

History

History
38 lines (22 loc) · 1.04 KB

log.md

File metadata and controls

38 lines (22 loc) · 1.04 KB

log - use the $log service instead of the console methods

You should use $log service instead of console for the methods 'log', 'debug', 'error', 'info', 'warn'

Rule based on Angular 1.x

Examples

The following patterns are considered problems;

/*eslint angular/log: 2*/

// invalid
console.log('Hello world!'); // error: You should use the "log" method of the AngularJS Service $log instead of the console object

// invalid
console.error('Some error!'); // error: You should use the "error" method of the AngularJS Service $log instead of the console object

The following patterns are not considered problems;

/*eslint angular/log: 2*/

// valid
$log.log('Hello world!');

// valid
$log.error('Some error!');

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links