New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-remove-logging

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-remove-logging

Removes console logging statements.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gulp-remove-logging

Build Status Test Coverage NPM Downloads Gitter

Removes all console logging statements from your code.

This plugin is based on the initial work of @ehynds on grunt-remove-logging.

Getting Started

Install this plugin with the command:

npm install gulp-remove-logging

Next, add this line to your gulpfile:

var gulp_remove_logging = require("gulp-remove-logging");

Lastly, add the configuration settings (see below) to your gulpfile.

Task Configuration

gulp.task("remove_logging", function() {
  return gulp.src("src/javascripts/**/*.js")
    .pipe(
      gulp_remove_logging({
        // Options (optional)
        // eg:
        // namespace: ['console', 'window.console']
      })
    )
    .pipe(
      gulp.dest(
        "build/javascripts/"
      )
    );
});

Optional Configuration Properties

This plugin can be customized by specifying the following options:

  • replaceWith: A value to replace logging statements with. This option defaults to an empty string. If you use fancy statements like console && console.log("foo");, you may choose to specify a replaceWith value like 0; so that your scripts don't completely break.
  • namespace: An array of object names that logging methods are attached to. Defaults to [ 'console', 'window.console' ]. If you use a custom logger, like MyApp.logger.log(foo), you would set this option to [MyApp.logger].
  • methods: An array of method names to remove. Defaults to all the methods in the Firebug console API. This option is useful if you want to strip out all log methods, but keep warn for example.
  • verbose: Boolean value, whether to show count of logging statements removed for each file. Defaults to true. If false, a single summary line is logged to gulp instead.

Skip Individual Statements

You can tell this task to keep specific logging statements by adding the comment directive /*RemoveLogging:skip*/ after the statement:

console.log("foo");/*RemoveLogging:skip*/

// or:

console.log("foo")/*RemoveLogging:skip*/;

// whitespace is fine too, whatever floats your boat:

console.log("foo") /* RemoveLogging:skip */;

Keywords

FAQs

Package last updated on 24 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc