log_removal 1.2.0 copy "log_removal: ^1.2.0" to clipboard
log_removal: ^1.2.0 copied to clipboard

A CLI tool for removing unwanted logs from Dart and Flutter projects.


🔧 Log Removal #

Log Removal is a command-line tool designed to clean up Dart/Flutter projects by removing unwanted log statements, such as print, debugPrint, logger, and other custom log patterns.

This tool allows users to select predefined log patterns or add their custom patterns using regular expressions (regex). It can be installed globally for seamless usage across multiple projects.


✨ Key Features #

  • Global Usage: Install once and use it in all your Dart/Flutter projects.
  • Multi-select: Remove multiple log patterns in one go.
  • Custom Patterns: Add custom log patterns with regex.
  • High Compatibility: Specifically built for Dart and Flutter projects.
  • User-Friendly: A simple text-based interface to select files or folders for processing.

⚙️ Installation #

1. Global Installation #

Install Log Removal globally to use it across all your projects with the following command:

dart pub global activate log_removal
copied to clipboard

After installation, the log_removal command will be available globally in your terminal, ready to use in any project directory.

2. Local Installation (Optional) #

If you want to use Log Removal in a specific project, add it as a dependency:

dependencies:
  log_removal: <latest_version>
copied to clipboard

Then, run it using the following command within the project:

dart run log_removal
copied to clipboard

🚀 How to Use #

1. Running the Program #

Once installed, run the program with:

log_removal
copied to clipboard

2. Select an Operation #

Choose one of the following options:

  • Specific File: Clean logs from a specific file.
  • Specific Folder: Clean logs from a specific folder.
  • Entire Project: Clean logs from the entire project.

3. Choose Log Patterns #

The program will display a list of log patterns to remove, such as:

  • print(...)
  • debugPrint(...)
  • logger.*(...)
  • logMessage(...)

You can select multiple patterns or add a custom pattern using regex.

4. Cleaning Results #

After processing, the program will display:

  • The number of files processed.
  • The number of logs removed.

📂 Example #

Running the CLI #

$ log_removal
🔧 Welcome to Log Removal!
Let's clean up your project from unwanted logs. 🚀

📂 Select a folder from the current directory:
✅ Folder selected: /path/to/project

Choose log patterns to remove:
[0] print(...)
[1] debugPrint(...)
[2] logger.*(...)
[3] logMessage(...)
[4] Custom pattern
Select options (e.g., 0,1,3): 0,1,4

🔧 Enter your custom regex pattern:
^\s*customLog\(.*\);\s*$

✅ Custom pattern added.
✅ Log removal completed.
📁 Files Processed: 5
copied to clipboard

🛠 Supported Log Patterns #

The predefined log patterns include:

  1. print(...): Matches print() statements.
  2. debugPrint(...): Matches debugPrint() statements.
  3. logger.*(...): Matches logging functions like logger.d() or logger.e().
  4. logMessage(...): Matches custom log functions like logMessage().

In addition to these, you can add custom log patterns using name of log to handle unique logging formats in your projects.


🤝 Contributing #

Contributions are welcome!
To contribute:

  1. Fork this repository.
  2. Create a new branch for your feature or fix.
  3. Submit a pull request with a clear description of your changes.

📄 License #

This project is licensed under the MIT License.


This version is cleaner, more concise, and user-friendly. 🎉

7
likes
140
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

2024.10.02 - 2025.04.16

A CLI tool for removing unwanted logs from Dart and Flutter projects.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

dart_console, interact

More

Packages that depend on log_removal