// Default level is 6, and 0,3,7 are regularly used.  Bump the logging level up to 7 to get verbose logs.
        void SetLoggingLevel(int Threshold)
        {
            Int32 LoggingThreshold = Math.Min(Math.Max(0, Threshold), 7);

            MobileDevice.CFPreferencesSetAppValue(
                (IntPtr)MobileDevice.CFStringMakeConstantString("LogLevel"),
                (IntPtr)MobileDevice.CFNumberCreate(LoggingThreshold),
                (IntPtr)MobileDevice.CFStringMakeConstantString("com.apple.MobileDevice"));
        }