Skip to main content
Beagle provides two built-in log types for common logging scenarios: MessageLog for general messages and ErrorLog for error tracking.

Log Levels

Beagle supports five log levels to categorize your logs:
  • loading - For pending operations
  • info - For informational messages (default)
  • warning - For warnings that need attention
  • error - For errors and exceptions
  • success - For successful operations
Each log level is visually distinguished in the Beagle inspector with different colors and indicators.

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

The ErrorLog class automatically handles different error types:
When you log an error, Beagle’s 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

Use MessageLog for:
  • Application state changes
  • User actions and events
  • API call status updates
  • Feature flag toggles
  • Success confirmations
  • General debugging information

Complete Example

Here’s a complete example showing both log types in action:
Open the Beagle inspector to see all your logs organized by timestamp, with color-coded indicators for each log level.