MessageLog for general messages and ErrorLog for error tracking.
Log Levels
Beagle supports five log levels to categorize your logs:loading- For pending operationsinfo- For informational messages (default)warning- For warnings that need attentionerror- For errors and exceptionssuccess- For successful operations
Using MessageLog
MessageLog is perfect for logging general information, warnings, and success messages throughout your application.
1
Import MessageLog
2
Log messages with different levels
The second parameter (log level) is optional and defaults to
'info' if not specified.Using ErrorLog
ErrorLog is specifically designed for error tracking. It automatically extracts error details including the message, stack trace, and cause.
1
Import ErrorLog
2
Log errors in try-catch blocks
ErrorLog Implementation
TheErrorLog class automatically handles different error types:
ErrorLogPlugin provides a detailed view that includes:
- Name: The error type (e.g.,
TypeError,ReferenceError) - Message: The error message
- Stack: Full stack trace for debugging
- Cause: The underlying cause if available
When to Use Each Log Type
- MessageLog
- ErrorLog
Use
MessageLog for:- Application state changes
- User actions and events
- API call status updates
- Feature flag toggles
- Success confirmations
- General debugging information