README
ΒΆ
mtlog-analyzer GoLand Plugin
Real-time validation for mtlog message templates in GoLand and other JetBrains IDEs with Go support.
Features
- π Real-time template validation as you type
- π― Three severity levels: errors, warnings, and suggestions
- π¨ Intelligent highlighting:
- Template/argument errors highlight the template string and arguments
- Property naming warnings highlight only the property name
- π§ Quick fixes for common issues:
- PascalCase property name conversion
- Template argument count corrections
- Format specifier fixes (e.g.,
{Count:d3}β{Count:000}) - Context key constant extraction
- LogValue() method stub generation for safe logging
- βοΈ Configurable analyzer path and flags
- π Performance optimized with caching and debouncing
- π₯οΈ Full support for Windows, macOS, and Linux
Requirements
- GoLand 2024.2 or later (or IntelliJ IDEA Ultimate with Go plugin)
- mtlog-analyzer (automatically detected or can be installed via notification)
Installation
-
Install from JetBrains Marketplace:
- Open GoLand
- Go to Settings β Plugins β Marketplace
- Search for "mtlog-analyzer"
- Click Install
-
The plugin will automatically find mtlog-analyzer if it's installed. If not found, you'll see a notification with an "Install" button for one-click installation.
Automatic Detection
The plugin searches for mtlog-analyzer in the following locations (in order):
- Configured path in settings
- System PATH
- Go binary locations:
$GOBIN$GOPATH/bin~/go/bin(default Go install location)- Platform-specific locations (e.g.,
%LOCALAPPDATA%\Microsoft\WindowsAppson Windows)
Configuration
Go to Settings β Tools β mtlog-analyzer to configure:
- Analyzer Path: Path to mtlog-analyzer executable (auto-detected by default)
- Additional Flags: Extra command-line flags for the analyzer
- Severity Levels: Customize how errors, warnings, and suggestions are displayed
Usage
The plugin automatically analyzes Go files as you type, showing diagnostics inline:
- Red underline: Template/argument mismatch errors
- Yellow underline: Warnings (e.g., using @ with basic types)
- Gray underline: Suggestions (e.g., property naming conventions)
Use Alt+Enter on any diagnostic to see available quick fixes.
Suppression
You can suppress diagnostics using:
//noinspection MTLog- Suppress on the next line// MTLOG-IGNORE- Inline suppression
Troubleshooting
"mtlog-analyzer not found"
If the plugin can't find mtlog-analyzer:
- Automatic Installation: Click "Install" in the notification that appears
- Manual Installation: Run
go install github.com/willibrandon/mtlog/cmd/mtlog-analyzer@latest - Custom Location: Go to Settings β Tools β mtlog-analyzer and specify the full path
- PATH Issues: Ensure your Go bin directory is in your system PATH
No diagnostics appearing
- Check the Event Log for analyzer errors
- Verify mtlog-analyzer works from terminal:
mtlog-analyzer your-file.go - Check Settings β Tools β mtlog-analyzer to ensure the plugin is enabled
- Try restarting the analyzer from the status bar widget
Development
Building
./gradlew buildPlugin
Running
./gradlew runIde
Testing
./gradlew test
License
MIT - Same as the main mtlog project.
Click to show internal directories.
Click to hide internal directories.