
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
babel-plugin-shotgun-logs
Advanced tools
npm install babel-plugin-shotgun-logs
And then configure your project to run with babel plugins (docs)
[
[
"babel-plugin-shotgun-logs",
{
"functionNameBlacklist": [ "unimportantFunction" ],
"functionNameBlackoutList": [ "functionName" ],
"isTerminal": true,
"entryLogShowFullArgs": false,
"entryLogArgOutputInline": true,
"entryLogMultilineJSONargs": false,
"exitLogReturnOutputInline": true,
"exitLogStubObjects": true,
"timeProfiling": false,
"storeJSONexternally": {
"sizeThreshold": 10000,
"location": "s3",
"bucket": "deleteme-shotgun-log-json-test"
}
}
]
]
A list of functions not to include in the shotgun log output
A list of functions to log but NOT log any functions that get called by this function
š¢ main() {"arg1":{"key1":1,"key2":2},"arg2":5}
--š¢ a() {"arg1":{"key1":1,"key2":2},"arg2":5}
----š¢ y() {"arg1":{"key1":1,"key2":2},"arg2":5}
----š“ y() ā {"a":1,"b":2}
----š¢ z() {"arg1":{"key1":1,"key2":2},"arg2":5}
----š“ z() ā {"a":1,"b":2}
--š“ a() ā {"a":1,"b":2}
š“ main() ā {"a":1,"b":2}
When set to [ "a" ]:
š¢ main() {"arg1":{"key1":1,"key2":2},"arg2":5}
--š¢ a() {"arg1":{"key1":1,"key2":2},"arg2":5}
--š“ a() ā {"a":1,"b":2}
š“ main() ā {"a":1,"b":2}
Boolean flag if you are viewing the shotgun log output on the terminal. This option changes the way that emojis are displayed to have the correct spacing in the terminal
When the log file reaches this size, a new log file will be created and the previous log file will
be deleted.
NOTE: Log file format is log/shotgun.log.<unix_timestamp>
Examples:
{
sizeThreshold: 10000,
location: 'local',
}
{
sizeThreshold: 10000,
location: 's3',
bucket: 'bucket_name'
}
The size in bytes that JSON needs to exceed to be written externally rather than in the .log file
Options: ['local', 's3']
If local
: files are written to log/json/
If s3
: files are written to an S3 bucket. The bucket name needs to be specified in the object and
the credentials need to be specified by the env variables AWS_ACCESS_KEY_ID and
AWS_SECRET_ACCESS_KEY with permission to access the bucket specified
TODO: add other options for specifying S3 credentials
The bucket to upload JSON files to if they are larger than the threshold. Only used if location
is set to s3
.
Example default function entry log:
š¢ main( arg1: { ... }, arg2: 5 ) {"arg1":{"key1":1,"key2":2},"arg2":5}
Logs all of the arguments & values to the function as JSON after the signature
When true:
š¢ main( arg1: { ... }, arg2: 5 ) {"arg1":{"key1":1,"key2":2},"arg2":5}
When false:
š¢ main( arg1: { ... }, arg2: 5 )
Logs the arguments output as multiline JSON
When true:
š¢ main( arg1: { ... }, arg2: 5 ) {
"arg1": {
"key1":1,
"key2":2
},
"arg2":5
}
When false:
š¢ main( arg1: { ... }, arg2: 5 ) {arg1:{"key1":1,"key2":2},"arg2":5}
Displays the argument object on the same line as the signature
When true:
š¢ main( arg1: { ... }, arg2: 5 ) {"arg1":{"key1":1,"key2":2},"arg2":5}
When false:
š¢ main( arg1: { ... }, arg2: 5 )
{"arg1":{"key1":1,"key2":2},"arg2":5}
The symbol to use at the start of an entry log
Default:
š¢ main( arg1: { ... }, arg2: 5 ) {"arg1":{"key1":1,"key2":2},"arg2":5}
entryLogSymbol = $
$ main( arg1: { ... }, arg2: 5 ) {"arg1":{"key1":1,"key2":2},"arg2":5}
Example default function exit logs:
š“ main() ā {"a":1,"b":2}
š“ main() ā 10.5
Stubs the return value output when it is an object (leaves the value the same when the return value is a different primitive)
When true:
š“ main() ā { ... }
š“ main() ā 10.5
When false:
š“ main() ā {"a":1,"b":2}
š“ main() ā 10.5
Outputs the return value in the same line as the function name
When true:
š“ main() ā {"a":1,"b":2}
š“ main() ā 10.5
When false:
š“ main() ā
{"a":1,"b":2}
š“ main() ā
10.5
The symbol to use at the start of an entry log
Default:
š“ main() ā {"a":1,"b":2}
exitLogSymbol = $
$ main() ā {"a":1,"b":2}
Displays how long the function took to run
When true:
š“ main() ā±ļø 1005.789 ms ā {"a":1,"b":2}
FAQs
## Getting Started `npm install babel-plugin-shotgun-logs`
The npm package babel-plugin-shotgun-logs receives a total of 658 weekly downloads. As such, babel-plugin-shotgun-logs popularity was classified as not popular.
We found that babel-plugin-shotgun-logs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.