This document outlines the log types used in the project, categorized by OSLogLevel and their intended purposes.
By default, log level is .error
, you can set this with CursorBoundsConfig
CursorBoundsConfig.shared.logLevel = .debug
OSLogLevel | Icon | Description |
---|---|---|
.log / .trace / .debug |
🔍 [DEBUG] | Provides detailed, low-level information useful for debugging or tracing application flow. |
.info |
ℹ️ [INFO] | Highlights informational messages about the application's state or operations. |
.notice |
🗒️ [NOTICE] | Indicates noteworthy events that don’t require attention but are worth logging. |
.warning |
Reports potential issues or recoverable errors that may affect the application's behavior. | |
.error |
🚨 [ERROR] | Signals critical failures requiring immediate attention to prevent or resolve issues. |
.critical |
🚫 [CRITICAL] | Indicates severe errors causing disruption in functionality or requiring urgent action. |
.fault |
❗ [FAULT] | Logs significant system-level errors indicating potential issues in the operating environment. |
- Used for detailed tracing and debugging purposes.
- Example:
🔍 [DEBUG] [getMouseCursorRect] Start 🔍 [DEBUG] [getCaretBounds] Successfully obtained AXValue: (x: 10, y: 20, width: 100, height: 50)
- Highlights normal, significant events or state transitions.
- Example:
ℹ️ [INFO] [getCursorPosition] Successfully retrieved cursor position: 42
- Logs noteworthy, but non-critical events.
- Example:
🗒️ [NOTICE] [getAttributeString] Attribute 'AXRole' was unexpectedly empty but processing continues.
- Reports potential issues or recoverable problems.
- Example:
⚠️ [WARNING] [getMouseCursorRect] Failed to find screen containing mouse location.
- Logs critical application errors.
- Example:
🚨 [ERROR] [getCaretRect] Failed to retrieve AXFrame attribute.
- Indicates severe errors requiring immediate attention.
- Example:
🚫 [CRITICAL] [getAttributeRect] Unexpected nil value for critical attribute AXFrame.
- Reserved for system-level errors indicating significant problems.
- Example:
❗ [FAULT] [getCursorPosition] System-level error: AXUIElement not responding.
The logging function adheres to a threshold defined by the current log level, ensuring only logs meeting or exceeding the set level are printed. Each log type uses the appropriate OSLogLevel
and is formatted with an icon for clarity.