RFLIB Plugin for Salesforce CLI - j-fischer/rflib GitHub Wiki
The RFLIB Plugin for Salesforce CLI accelerates the adoption of the RFLIB logging library by automating the instrumentation of logging statements into your Salesforce codebase. This plugin eliminates manual effort, promotes consistency, and ensures comprehensive logging coverage across your Apex classes, Lightning Web Components (LWC), and Aura components.
Effective logging is crucial for monitoring and debugging applications, especially in dynamic Salesforce environments. However, implementing a robust logging framework like RFLIB can be challenging due to the repetitive nature of integrating logging statements. The RFLIB plugin addresses this challenge by automating the process. It:
- Saves time and reduces errors during logging integration.
- Standardizes logging practices across different components.
- Supports seamless integration with RFLIB's powerful features, such as log aggregation, masking, and dashboards.
- Encourages faster adoption of the RFLIB framework by developers.
-
Automatic Instrumentation:
- Adds logging statements for method entry, parameter values, error handling, and condition blocks.
- Automatically integrates with RFLIB's logger initialization.
-
Component Support:
- Apex classes, including test classes.
- Lightning Web Components (LWC).
- Aura components.
-
Customizable Behavior:
- Includes options to skip certain structures like
if/else
blocks. - Formats code using Prettier for consistent style.
- Includes options to skip certain structures like
-
Preview Changes:
- Supports dry-run mode to preview modifications before applying them.
To install the plugin, run:
sf plugins install rflib-plugin
For detailed installation steps, see the README file.
Analyze and instrument Apex classes with RFLIB logging statements.
sf rflib logging apex instrument --sourcepath <directory> [--dryrun] [--prettier] [--no-if]
Instrument JavaScript files in Lightning Web Components.
sf rflib logging lwc instrument --sourcepath <directory> [--dryrun] [--prettier] [--no-if]
Add logging to Aura components' controllers, helpers, and renderers.
sf rflib logging aura instrument --sourcepath <directory> [--dryrun] [--prettier] [--no-if]
-
Add logging to Apex classes:
sf rflib logging apex instrument --sourcepath force-app/main/default/classes
-
Preview changes for Aura components:
sf rflib logging aura instrument --sourcepath force-app/main/default/aura --dryrun
-
Instrument and format LWC components:
sf rflib logging lwc instrument --sourcepath force-app/main/default/lwc --prettier
We welcome contributions to enhance the RFLIB plugin. Visit the GitHub repository for more details on how to contribute.