@rasulahmedkhan17/logthis
v1.0.0
Published
CLI tool to automatically inject debug logs into source files
Maintainers
Readme
logthis
CLI tool to automatically inject debug logs into functions in your source files.
Installation
npm install -g .Or link locally:
npm linkUsage
# Global command
logthis <filename>
# Via npm script
npm run logthis -- <filename>Examples
logthis index.ts
logthis src/app.js
logthis components/Button.jsxFeatures
- Injects
console.logwith chalk-colored debug messages - Supports JavaScript, TypeScript, and JSX files
- Preserves existing code structure
- Detects and skips files with existing debug logs
- Automatically adds chalk import if missing
Supported Function Types
- Function declarations
- Arrow functions
- Class methods
- Object methods
- Function expressions
Output Format
console.log(chalk.green("DEBUG: [filename.js]"), chalk.yellow("-> Function: [functionName]"));Requirements
- Node.js 14+
- npm 6+
License
MIT
