Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

babel-plugin-transform-remove-logger

Intended for multi-level logging implementations, this transformer removes logging calls for selected log levels. For example, if our logger supports these levels: fine, debug, info, warn, we might want to remove fine & debug messages for production builds...

Which logging calls are to be elided can be configured via plugin options provided in .babelrc. See example below. By default only fine & debug calls are removed.

For each log level, the following call patterns are matched:

  • logger.<level>(...)
  • LOGGER.<level>(...)
  • *.logger.<level>(...)
  • *.LOGGER.<level>(...)
  • *.*.logger.<level>(...)
  • *.*.LOGGER.<level>(...)

Installation

$ npm install babel-plugin-transform-remove-logger

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-remove-logger"]
}

...or with options:

{
  "plugins": [["transform-remove-logger", { levels: "fine,debug" }]]
}

Via CLI

$ babel --plugins transform-remove-logger script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-remove-logger"]
});

License

© 2017 Karsten Schmidt, MIT licensed

About

Babel plugin to remove logging calls for selected log levels

Resources

License

Releases

No releases published
You can’t perform that action at this time.