{"id":17772539,"url":"https://github.com/kwelch/babel-plugin-captains-log","last_synced_at":"2025-03-15T16:31:36.230Z","repository":{"id":20181322,"uuid":"89085759","full_name":"kwelch/babel-plugin-captains-log","owner":"kwelch","description":"Babel plugin that injects helpful details into console statements","archived":false,"fork":false,"pushed_at":"2023-12-15T02:53:12.000Z","size":2518,"stargazers_count":85,"open_issues_count":27,"forks_count":7,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-13T19:21:36.943Z","etag":null,"topics":["babel","babel-plugin","console-statements","logging","utility"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kwelch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-22T17:04:21.000Z","updated_at":"2024-06-18T18:37:09.978Z","dependencies_parsed_at":"2024-06-18T18:36:53.313Z","dependency_job_id":"6801ec17-fbed-4f7c-80b0-bee8a0a3248c","html_url":"https://github.com/kwelch/babel-plugin-captains-log","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwelch%2Fbabel-plugin-captains-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwelch%2Fbabel-plugin-captains-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwelch%2Fbabel-plugin-captains-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwelch%2Fbabel-plugin-captains-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwelch","download_url":"https://codeload.github.com/kwelch/babel-plugin-captains-log/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221587156,"owners_count":16848049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","babel-plugin","console-statements","logging","utility"],"created_at":"2024-10-26T21:39:37.610Z","updated_at":"2024-10-26T21:39:38.265Z","avatar_url":"https://github.com/kwelch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Captain's Log (☠️)\n\n[![version](https://img.shields.io/npm/v/babel-plugin-captains-log.svg?style=flat-square)](http://npm.im/babel-plugin-captains-log)\n[![downloads](https://img.shields.io/npm/dm/babel-plugin-captains-log.svg?style=flat-square)](http://npm-stat.com/charts.html?package=babel-plugin-captains-log)\n[![Travis Build Status](https://img.shields.io/travis/kwelch/babel-plugin-captains-log.svg?style=flat-square)](https://travis-ci.com/kwelch/babel-plugin-captains-log.svg)\n[![codecov](https://codecov.io/gh/kwelch/babel-plugin-captains-log/branch/main/graph/badge.svg?style=flat-square)](https://codecov.io/gh/kwelch/babel-plugin-captains-log)\n\n[![MIT License](https://img.shields.io/npm/l/kwelch.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n\n[![Watch on GitHub](https://img.shields.io/github/watchers/kwelch/babel-plugin-captains-log.svg?style=social)](https://github.com/kwelch/babel-plugin-captains-log/watchers)\n[![Star on GitHub](https://img.shields.io/github/stars/kwelch/babel-plugin-captains-log.svg?style=social)](https://github.com/kwelch/babel-plugin-captains-log/stargazers)\n[![Tweet](https://img.shields.io/twitter/url/https/github.com/kwelch/babel-plugin-captains-log.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20out%20babel-plugin-captains-log!%20https://github.com/kwelch/babel-plugin-captains-log%20%F0%9F%91%8D)\n\n## Usage\n\n`babel-plugin-captains-log` injects helpful details into console statements.\n\nDefault behavior:\n\n- prepend console statement file \u0026 location\n- add inject variable name into console statements\n\n**Transforms**\n\n```diff\nfunction add(a = 1, b = 2) {\n  console.log(a); // outputs: 1\n  return a + b;\n}\n↓ ↓ ↓ ↓ ↓ ↓\nfunction add(a = 1, b = 2) {\n  console.log(\"simple.js(2:2)\", \"a\", a); // outputs: \"simple.js(2:2)\" \"a\" 1\n  return a + b;\n}\n```\n\nSee the [Issues][issues] for a future features and opportunities to contribute.\n\n## Requirements\n\nThis is a Babel plugin so it requires Babel v6 to run.\n\n## Installation\n\nThis module is distributed using npm which comes bundled with node:\n\n```\nnpm install --save-dev babel-plugin-captains-log\n```\n\nTo 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:\n\n```\n{\n  plugins: [\"babel-plugin-captains-log\"]\n}\n```\n\n## Options\n\n### Methods\n\nThis option provides control over which console statements are adjusted. Methods is set within your `.babelrc` as an array.\n\n**Default**: `[\"debug\", \"error\", \"exception\", \"info\", \"log\", \"warn\"]`\n\n```\n{\n  plugins: [\n    [\"babel-plugin-captains-log\", {\n      \"methods\": ['debug', 'info']\n    }]\n  ]\n}\n```\n\n### Ignore Patterns\n\nThis option provides control over which files are adjusted. Ignore Patterns is set within your `.babelrc` as an array of strings.\n\n**Default**: `[\"node_modules\"]`\n\n```\n{\n  plugins: [\n    [\"babel-plugin-captains-log\", {\n      \"ignorePatterns\": [\"node_modules\", \".spec.js\"]\n    }]\n  ]\n}\n```\n\n### Use a logger other then console\n\nThis option provides control over which files are adjusted. Ignore Patterns is set within your `.babelrc` as an array of strings.\n\n**Default**: `\"console\"`\n\n```\n{\n  plugins: [\n    [\"babel-plugin-captains-log\", {\n      \"loggerName\": \"logger\"\n    }]\n  ]\n}\n```\n\n### Flags\n\nFlags 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.\n\n#### Variable Name Labels\n\n**Default**: `true`\n\n```\n{\n  plugins: [\n    [\"babel-plugin-captains-log\", {\n      \"injectVariableName\": true\n    }]\n  ]\n}\n```\n\n#### File Location Data\n\n**Default**: `true`\n\n```\n{\n  plugins: [\n    [\"babel-plugin-captains-log\", {\n      \"injectFileName\": true\n    }]\n  ]\n}\n```\n\n#### Inject Scope _(Experimental)_\n\n_This has a few issues with other plugins particularly react-hot-loader, as it changes method names. Also, it was written for recursion which adds too much noise to the console statement which is against this libraries purpose_\n\n**Default**: `false`\n\n```\n{\n  plugins: [\n    [\"babel-plugin-captains-log\", {\n      \"injectScope\": true\n    }]\n  ]\n}\n```\n\n## License\n\nMIT\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\n| [\u003cimg src=\"https://avatars0.githubusercontent.com/u/1295580?v=3\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003eKyle Welch\u003c/sub\u003e](http://www.krwelch.com)\u003cbr /\u003e[💻](https://github.com/kwelch/babel-plugin-captains-log/commits?author=kwelch \"Code\") [📖](https://github.com/kwelch/babel-plugin-captains-log/commits?author=kwelch \"Documentation\") [⚠️](https://github.com/kwelch/babel-plugin-captains-log/commits?author=kwelch \"Tests\") | [\u003cimg src=\"https://avatars1.githubusercontent.com/u/9456433?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003eMaksim\u003c/sub\u003e](https://github.com/mqklin)\u003cbr /\u003e[🐛](https://github.com/kwelch/babel-plugin-captains-log/issues?q=author%3Amqklin \"Bug reports\") |\n| :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!\n\n[issues]: https://github.com/kwelch/babel-plugin-captains-log/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwelch%2Fbabel-plugin-captains-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwelch%2Fbabel-plugin-captains-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwelch%2Fbabel-plugin-captains-log/lists"}