{"id":21616958,"url":"https://github.com/kgrz/babel-plugin-console-groupify","last_synced_at":"2025-09-03T08:18:39.941Z","repository":{"id":46933535,"uuid":"106456754","full_name":"kgrz/babel-plugin-console-groupify","owner":"kgrz","description":"A small babel plugin that wraps console.logs inside a console.group with surrounding function name","archived":false,"fork":false,"pushed_at":"2022-12-07T09:50:31.000Z","size":343,"stargazers_count":59,"open_issues_count":12,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-16T12:58:57.348Z","etag":null,"topics":["babel-plugin","console-log","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kgrz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-10T18:37:51.000Z","updated_at":"2023-10-13T19:43:29.000Z","dependencies_parsed_at":"2023-01-24T16:30:59.649Z","dependency_job_id":null,"html_url":"https://github.com/kgrz/babel-plugin-console-groupify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kgrz/babel-plugin-console-groupify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrz%2Fbabel-plugin-console-groupify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrz%2Fbabel-plugin-console-groupify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrz%2Fbabel-plugin-console-groupify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrz%2Fbabel-plugin-console-groupify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgrz","download_url":"https://codeload.github.com/kgrz/babel-plugin-console-groupify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrz%2Fbabel-plugin-console-groupify/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260203343,"owners_count":22974075,"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-plugin","console-log","javascript"],"created_at":"2024-11-24T22:16:00.194Z","updated_at":"2025-06-30T16:36:34.503Z","avatar_url":"https://github.com/kgrz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Console Groupify plugin for Babel\n---------------------------------\n\n\nScratching another itch with this. Sometimes when I'm developing in\nReact, I wish there was a way to group the `console.log` statements when\nused inside the life-cycle functions, and add some kind of visual\nseparation between `console.log`s in different functions.\n\nThis plugin checks for `console.log`s inside functions, and wraps them\ninside a `console.group`/`console.groupEnd` set, with the function name\npassed in as a variable for `console.group`. For example:\n\n```javascript\n\nfunction aFunctionDeclaration () {\n  console.log('hi');\n}\n\nconst aFunctionExpression = function () {\n  console.log('hi')\n}\n\nconst anArrowFunction = () =\u003e {\n  console.log('hi')\n}\n\n```\n\nends up looking like:\n\n\n```\n▼ aFunctionDeclaration\n  | hi\n\n▼ aFunctionExpression\n  | hi\n\n▼ anArrowFunction\n  | hi\n```\n\n\nCombining this with the\nhttps://github.com/kgrz/babel-plugin-transform-console-log-variable-names,\nthe printf-debugging becomes way better. For example, in a React\ncomponent:\n\n\n```javascript\nclass MyComponent extends React.Component {\n  componentWillReceiveProps ( nextProps ) {\n    console.log(this.props);\n    console.log(nextProps);\n  }\n}\n```\n\nprints out:\n\n```\n▼ componentWillReceiveProps\n  | this.props: { prop1: \"one\" }\n  | nextProps: { prop1: \"two. what the!\" }\n\n```\n\n\nActual screenshot from actual usage:\n\n![both-plugins-together](https://user-images.githubusercontent.com/400299/31451006-90ae7798-aec8-11e7-8ca1-83bada8343f9.png)\n\n**Note that both these plugins are at a pretty alpha quality.**\n\n\n\nUsage\n-----\n\nInstall the module with:\n\n```\nnpm install --save babel-plugin-console-groupify\n```\n\nInclude it in your babel configuration either via `.babelrc` or webpack.\nHere's a `.babelrc` example:\n\n```json\n{\n\t\"presets\": [...],\n\t\"plugins\": [\n\t\t\"console-groupify\"\n\t]\n}\n```\n\nKnown Issues\n------------\n\n* A spread operator inside a switch statement seems to be causing issues\n  when used with the `babel-transform-object-rest-spread` plugin. For\n  instance:\n\n  ```javascript\n\n  function myReducer (state = {}, action = {}) {\n    console.log('hi');\n    switch (action.type) {\n      case 'some_action':\n        return { ...state, key: value }\n    }\n  }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgrz%2Fbabel-plugin-console-groupify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgrz%2Fbabel-plugin-console-groupify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgrz%2Fbabel-plugin-console-groupify/lists"}