Successfully completed the transition from NSLog to Apple's modern os_log system for better performance, categorization, and system integration.
-
New Categories Added:
macwmfx_log_titlebar- For titlebar-related operationsmacwmfx_log_traffic_lights- For traffic light controlsmacwmfx_log_shadow- For window shadow operationsmacwmfx_log_outline- For window outline/border operations- Existing:
macwmfx_log_server,macwmfx_log_client,macwmfx_log_config,macwmfx_log_window,macwmfx_log_hook,macwmfx_log_cli,macwmfx_log_general
-
Convenience Macros:
MACWMFX_LOG_INFO(category, ...)- For informational messagesMACWMFX_LOG_ERROR(category, ...)- For error messagesMACWMFX_LOG_DEBUG(category, ...)- For debug messagesMACWMFX_LOG_WARNING(category, ...)- For warningsMACWMFX_LOG_FAULT(category, ...)- For critical faults
-
Legacy Compatibility:
DLog()andVLog()macros now use os_log instead of NSLog- Maintains backward compatibility for existing code
-
CLI Tool (
src/modules/CLITool.m)- Replaced NSLog with
MACWMFX_LOG_ERRORfor pipe errors - Added logging initialization in main()
- Replaced NSLog with
-
Main Module (
src/main/macwmfx.m)- Added comprehensive logging for module lifecycle
- Initialization, start/stop, configuration loading
- Module loading/unloading tracking
-
Client (
src/client/macwmfx_client.m)- Added logging initialization
- Client connection and response logging
-
Window Example (
src/modules/windows/features/window_example.m)- Converted all NSLog calls to appropriate os_log categories
- Used
macwmfx_log_window,macwmfx_log_shadow,macwmfx_log_titlebar
-
Custom Title (
src/modules/windows/features/windowTitlebar/ForceCustomTitle.m)- Error handling with
MACWMFX_LOG_ERROR - Info logging with
MACWMFX_LOG_INFO - Used privacy-aware format strings (
%{public}@)
- Error handling with
-
Titlebar Controls (
src/modules/windows/features/windowTitlebar/DisableTitleBars.m,TitlebarAesthetics.m)- Initialization and state change logging
- Proper categorization with
macwmfx_log_titlebar
-
Traffic Lights (
src/modules/windows/features/windowTrafficLights/disableTrafficLights.m)- Visibility state changes
- Used
macwmfx_log_traffic_lightscategory
-
Window Shadows (
src/modules/windows/features/windowShadow/DisableWindowShadow.m)- Shadow state management logging
- Configuration change tracking
- Used
macwmfx_log_shadowcategory
- macwmfx_globals.h
- Removed NSLog-based DLog/VLog macros
- Added reference to new os_log system
- Fixed include path for logging header
- Lazy Evaluation: os_log only formats strings when logs are actually collected
- Efficient Storage: Binary format reduces disk I/O
- Lower CPU Overhead: Especially for debug/verbose logging
- Console.app Integration: Logs appear properly categorized in Console
- Unified Logging: Integrates with system-wide logging infrastructure
- Log Streaming: Works with
log streamcommand for real-time monitoring
- Privacy-Aware Formatting:
%{public}@vs%@for sensitive data - Automatic Redaction: Private data automatically redacted in logs
- Structured Logging: Better parsing and analysis capabilities
- Categorized Logging: Easy filtering by subsystem and category
- Log Levels: Proper debug, info, error, fault level separation
- Persistence: Logs persist across reboots and crashes
MACWMFX_LOG_INFO(macwmfx_log_window, "Window updated successfully");
MACWMFX_LOG_ERROR(macwmfx_log_config, "Failed to load configuration: %{public}@", error);DLog(@"Debug message"); // Now uses os_log_info
VLog(@"Verbose message"); // Now uses os_log_debug# Real-time log streaming
log stream --predicate 'subsystem == "com.aspauldingcode.macwmfx"'
# Filter by category
log stream --predicate 'subsystem == "com.aspauldingcode.macwmfx" AND category == "window"'
# CLI tool log observation
macwmfx --observe-logs✅ Complete - All NSLog calls converted to os_log ✅ Tested - Compilation successful across all updated files ✅ Backward Compatible - Existing DLog/VLog macros still work ✅ Categorized - Proper logging categories for different subsystems ✅ Initialized - Logging system properly initialized in all entry points
- Monitor log output during runtime testing
- Adjust log levels as needed for production vs debug builds
- Consider adding more specific categories for new features
- Implement log rotation/cleanup policies if needed