Skip to main content
The Status and Logging API provides methods for communicating with users through status messages and logging plugin activity for debugging and monitoring.

Status Messages

setStatus

Display a transient message in the editor’s status bar.
string
required
Text to display (keep short - status bar has limited width)
The message will be shown until the next status update or user action. Use for feedback on completed operations (e.g., “File saved”, “2 matches found”).
Example:

Logging Functions

Fresh provides four log levels for plugin messages. Messages appear in the log file when running with appropriate RUST_LOG environment variable settings.

debug

Log a debug message from a plugin.
string
required
Debug message - include context like function name and relevant values
Messages appear in log file when running with RUST_LOG=debug. Useful for plugin development and troubleshooting.
Example:

info

Log an info message from a plugin.
string
required
Info message
Messages appear in log file when running with RUST_LOG=info. Use for important operational messages.
Example:

warn

Log a warning message from a plugin.
string
required
Warning message
Messages appear in log file when running with RUST_LOG=warn. Use for warnings that don’t prevent operation but indicate issues.
Example:

error

Log an error message from a plugin.
string
required
Error message
Messages appear in log file when running with RUST_LOG=error. Use for critical errors that need attention.
Example:

Log Levels

Control which messages appear in the log by setting the RUST_LOG environment variable:

Best Practices

  • debug(): Development info, variable values, function entry/exit
  • info(): Important milestones, configuration loaded, plugin initialized
  • warn(): Recoverable issues, missing config, deprecated features
  • error(): Critical failures, exceptions, data corruption
Make log messages self-explanatory by including relevant context:
Status messages are for users, log messages are for developers:
The status bar has limited width. Keep messages short and clear:

Examples

Progress indication

Error handling with logging

Debug logging for troubleshooting

Combining status and logging