Skip to content

js-logs-remover is a command-line utility written in Rust that removes specified console logging methods (e.g., console.log(), console.error()) from JavaScript/TypeScript files within a directory. This tool is useful for cleaning up log statements before deploying or publishing code.

License

Notifications You must be signed in to change notification settings

BaseMax/js-logs-remover-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-logs-remover in Rust

js-logs-remover is a command-line utility written in Rust that removes specified console logging methods (e.g., console.log(), console.error()) from JavaScript/TypeScript files within a directory. This tool is useful for cleaning up log statements before deploying or publishing code.

Features

  • Removes specified console methods from JavaScript, TypeScript, JSX, and TSX files.
  • Processes files recursively within directories, excluding certain common directories such as node_modules, .git, dist, and build.
  • Supports both specified log methods and a global "all" option to remove all defined console methods.

Installation

To install js-logs-remover, you must have Rust installed on your machine.

  1. Clone the repository:

    git clone https://github.com/BaseMax/js-logs-remover-rust.git
  2. Navigate to the directory:

    cd js-logs-remover-rust
  3. Build the Rust application:

    cargo build --release

After building, you will have a js-logs-remover binary in the project directory.

target
├── debug
└── release
    └── js-logs-remover.exe

Usage

Run the tool from the command line:

$ js-logs-remover [path] [log-methods]

[path]: The directory or file path where you want to remove the logs from. If no path is provided, it defaults to the current directory (.).

[log-methods]: A comma-separated list of console methods you want to remove (e.g., log,error,warn). If you specify all, it will remove all known console methods.

Example Usage

Remove specific console methods: To remove console.log and console.warn from all .js, .ts, .jsx, and .tsx files within the src directory:

$ js-logs-remover src log,warn

Remove all console methods: To remove all console methods (like console.log, console.error, etc.) from all files in the src directory:

$ js-logs-remover src all

Process the current directory: To process the current directory and remove console.log:

$ js-logs-remover . log

Excluded Directories

The following directories are automatically excluded from processing:

  • node_modules
  • .git
  • dist
  • build

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright

© 2025 Max Base. All rights reserved.

About

js-logs-remover is a command-line utility written in Rust that removes specified console logging methods (e.g., console.log(), console.error()) from JavaScript/TypeScript files within a directory. This tool is useful for cleaning up log statements before deploying or publishing code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages