0.1.2 • Published 8 years ago

grunt-remove-logging-calls v0.1.2

Weekly downloads
276
License
-
Repository
github
Last release
8 years ago

grunt-remove-logging-calls

About

This plugin removes/replaces all or any part of console logging statements from javascript code. It handles complex cases like console.log('hello: ' + foo(), bar()) because it's based on the syntax tree given by Esprima.

Getting Started

This plugin requires Grunt. Install this plugin with the command:

npm install grunt-remove-logging-calls

Once the plugin has been installed, enable it inside the Gruntfile:

grunt.loadNpmTasks('grunt-remove-logging-calls');

Finally, add some configuration.

Configuration

grunt.initConfig({
	// ...

	removeLoggingCalls: {
		// the files inside which you want to remove the console statements
 		files: ['src/**/*.js'],
 		options: {
 			// an array of method names to remove
			methods: ['log', 'info', 'assert'], 
			
			// replacement strategy
			strategy: function(consoleStatement) {
				// comments console calls statements
				return '/* ' + consoleStatement + '*/';

				// return ''; // to remove 
			},
			
			// when the logging statement is ended by a semicolon ';'
			// include it in the 'consoleStatement' given to the strategy
			removeSemicolonIfPossible: true
		
		}
	}

    // ...
});
0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago