Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-captains-log

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-captains-log

Babel plugin that injects helpful details into console statements

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
144
increased by4.35%
Maintainers
1
Weekly downloads
 
Created
Source

Captain's Log (☠️)

version downloads Travis Build Status codecov

MIT License Roadmap All Contributors semantic-release

Watch on GitHub Star on GitHub Tweet

Usage

babel-plugin-captains-log injects helpful details into console statements.

Default bahavior:

  • Prepend console statement scope
  • add inject variable name into console statements

Transforms

function add(a, b) {
-  console.log(a, b);
+  console.log("simple.js(2:2)", "add:", "a", a, "b", b);
  return a + b;
}

const subtract = (a, b) => {
-  console.log(a, b);
+  console.info("simple.js(7:2)", "subtract:", "a", a, "b", b);
  return a - b;
};

See the Roadmap for a future features and oppurtunities to contribute.

Requirements

This is a Babel plugin so it requires Babel v6 to run.

Installation

This module is distributed using npm which comes bundled with node:

npm install --save-dev babel-plugin-captains-log

To include the plugin in your project, create or open your .babelrc file at the root of your project. Then, add namespaces to your plugin list:

{
  plugins: ["captains-log"]
}

Options

Methods

This option provides control over which console statments are adjusted. Methods is set within your .babelrc as an array.

Default: ["debug", "error", "exception", "info", "log", "warn"]

{
  plugins: [
    ["captains-log", {
      methods: ['debug', 'info']
    }]
  ]
}

Flags

Flags are values set for all methods and are used to turn that feature on or off. Flags are not merged with defaults to allow for maximum control.

Variable Name

Default: true

{
  plugins: [
    ["captains-log", {
      injectVariableName: true
    }]
  ]
}
Inject Scope

Default: true

{
  plugins: [
    ["captains-log", {
      injectScope: true
    }]
  ]
}
Inject File Name

Default: true

{
  plugins: [
    ["captains-log", {
      injectFileName: true
    }]
  ]
}

Roadmap

  • Add ability to timestamp console statements

License

MIT

Contributors

Thanks goes to these wonderful people (emoji key):


Kyle Welch

💻 📖 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 29 Apr 2017

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