Registry / devops / babel-plugin-shotgun-logs

babel-plugin-shotgun-logs

JSON →
library0.0.5jsnpmunverified

A Babel plugin for automatically injecting detailed function entry and exit log statements into JavaScript code. Version 0.0.5 is the latest. The plugin instruments every function call with colored entry/exit logs including argument values, return values, and nested call indentation. It integrates with log management tools and supports options for function blacklisting, blackout lists, external JSON storage, and time profiling. Differentiates from simple logging libraries by being compile-time, thus requiring no runtime changes and providing full call tree visibility.

npm install babel-plugin-shotgun-logs
INSTALL
IMPORT
SIG · BABEL-PLUGIN-SHOTG
B
babel-plugin-shotgun-logs
devopsjavascriptv0.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import plugin from 'babel-plugin-shotgun-logs'
const plugin = require('babel-plugin-shotgun-logs').default
ESM default import works; CJS require yields the plugin function directly.
(plugin is default export)
plugins: ['babel-plugin-shotgun-logs']
plugins: [{ 'babel-plugin-shotgun-logs': {} }]
Do not wrap with extra object. In .babelrc or babel.config.js, just use the string name or an array tuple.

Shows installation, Babel configuration, and an example of instrumented function entry/exit logs.

// Install: npm install babel-plugin-shotgun-logs --save-dev // In .babelrc: { "plugins": [ ["babel-plugin-shotgun-logs", { "isTerminal": true, "entryLogShowFullArgs": true, "exitLogReturnOutputInline": true }] ] } // Example instrumented code (before/after): // Before: function add(a, b) { return a + b; } // After (output to log): // 🟢 add( a: 2, b: 3 ) {"a":2,"b":3} // 🔴 add() ⇒ 5 {"return":5}
Debug
Known issues
gotchaPlugin modifies all functions, including third-party code if not scoped. Use withIncludes/withExcludes to restrict.
fix
Configure Babel to exclude node_modules by default or use include/exclude patterns.
affects: >=0.0.0
gotchaLogging large arguments with entryLogShowFullArgs can produce enormous log files, potentially filling disk.
fix
Set entryLogShowFullArgs to false or use storeJSONexternally with a reasonable sizeThreshold.
affects: >=0.0.0
gotchaThe plugin does not work with TypeScript out-of-the-box; it only transforms JavaScript.
fix
Use @babel/preset-typescript to strip types before this plugin runs, or use babel-plugin-ts2js.
affects: >=0.0.0
gotchaS3 storage (storeJSONexternally.location: 's3') requires AWS credentials via environment variables, which may be a security risk.
fix
Ensure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set properly and restricted to the specific bucket.
affects: >=0.0.0
Errors
Common errors & fixes
ReferenceError: regeneratorRuntime is not defined
Babel transforms async functions but does not polyfill regeneratorRuntime. This plugin does not add the polyfill.
fix
Add @babel/plugin-transform-runtime and @babel/runtime to your Babel config.
TypeError: Cannot read property 'toString' of undefined
The plugin tries to log arguments that are undefined, causing a crash when calling .toString.
fix
Set entryLogShowFullArgs to false or ensure all function arguments are defined.
Module not found: Can't resolve 'aws-sdk'
storeJSONexternally with location 's3' requires aws-sdk as a peer dependency, which is not installed automatically.
fix
Install aws-sdk: npm install aws-sdk --save-dev
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Resources
babel-plugin-shotgun-logs — npm install babel-plugin-shotgun-logs · libregistry