babel-plugin-transform-remove-logger

    0.1.0 • Public • Published

    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

    Install

    npm i babel-plugin-transform-remove-logger

    DownloadsWeekly Downloads

    12

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • thi.ng