adium-1.4 3200:f04d1fb6ef86: Enable debug logging at runtime as ...

commits at adium.im commits at adium.im
Mon Nov 1 20:50:35 UTC 2010


details:	http://hg.adium.im/adium-1.4/rev/f04d1fb6ef86
revision:	3200:f04d1fb6ef86
author:		Evan Schoenberg
date:		Mon Nov 01 15:49:02 2010 -0500

Enable debug logging at runtime as appropriate rather than at compile times. Refs #14465 (where it was noted that a user's debug log didn't contain any libpurple information).

diffs (87 lines):

diff -r ca74edd1489e -r f04d1fb6ef86 Frameworks/Adium Framework/Source/ESDebugAILog.m
--- a/Frameworks/Adium Framework/Source/ESDebugAILog.m	Sun Oct 31 22:58:59 2010 -0500
+++ b/Frameworks/Adium Framework/Source/ESDebugAILog.m	Mon Nov 01 15:49:02 2010 -0500
@@ -32,6 +32,11 @@
 	[[NSNotificationCenter defaultCenter] postNotificationName:AIDebugLoggingEnabledNotification object:nil];
 }
 
+BOOL AIDebugLoggingIsEnabled()
+{
+	return AIDebugLoggingEnabled;	
+}
+
 /*!
  * @brief Adium debug log function
  *
diff -r ca74edd1489e -r f04d1fb6ef86 Frameworks/libjson-glib.framework/Versions/1.0.0/libjson-glib
Binary file Frameworks/libjson-glib.framework/Versions/1.0.0/libjson-glib has changed
diff -r ca74edd1489e -r f04d1fb6ef86 Plugins/Purple Service/SLPurpleCocoaAdapter.m
--- a/Plugins/Purple Service/SLPurpleCocoaAdapter.m	Sun Oct 31 22:58:59 2010 -0500
+++ b/Plugins/Purple Service/SLPurpleCocoaAdapter.m	Mon Nov 01 15:49:02 2010 -0500
@@ -163,6 +163,11 @@
 	purple_signal_emit(purple_network_get_handle(), "network-configuration-changed", NULL);
 }
 
+- (void)debugLoggingIsEnabledDidChange:(NSNotification *)inNotification
+{
+	purple_debug_set_enabled(AIDebugLoggingIsEnabled());
+}
+
 - (void)initLibPurple
 {
 	/* Initializing libpurple may result in loading a ton of buddies if our permit and deny lists are large; that, in
@@ -227,6 +232,13 @@
 									   name:AINetworkDidChangeNotification
 									 object:nil];
 
+	/* Be sure to enable debug logging if it is turned on after launch */
+	[[NSNotificationCenter defaultCenter] addObserver:self
+											 selector:@selector(debugLoggingIsEnabledDidChange:)
+												 name:AIDebugLoggingEnabledNotification
+											   object:nil];
+
+	
 	/* For any behaviors which occur on the next run loop, provide a buffer time of continued expectation of 
 	 * heavy activity.
 	 */
@@ -511,7 +523,7 @@
 					}
 
 					//In debug mode, verify we didn't miss any required values
-					if (PURPLE_DEBUG) {
+					if (AIDebugLoggingIsEnabled()) {
 						/* Get the chat_info for our desired account.  This will be a GList of proto_chat_entry
 						 * objects, each of which has a label and identifier.  Each may also have is_int, with a minimum
 						 * and a maximum integer value.
diff -r ca74edd1489e -r f04d1fb6ef86 Plugins/Purple Service/adiumPurpleCore.m
--- a/Plugins/Purple Service/adiumPurpleCore.m	Sun Oct 31 22:58:59 2010 -0500
+++ b/Plugins/Purple Service/adiumPurpleCore.m	Mon Nov 01 15:49:02 2010 -0500
@@ -39,7 +39,6 @@
 
 #pragma mark Debug
 // Debug ------------------------------------------------------------------------------------------------------
-#if (PURPLE_DEBUG)
 static void adiumPurpleDebugPrint(PurpleDebugLevel level, const char *category, const char *debug_msg)
 {
 	//Log error
@@ -60,7 +59,6 @@
 {
 	return &adiumPurpleDebugOps;
 }
-#endif
 
 // Core ------------------------------------------------------------------------------------------------------
 
@@ -136,10 +134,10 @@
 
 static void adiumPurpleCoreDebugInit(void)
 {
-#if (PURPLE_DEBUG)
 	AILog(@"adiumPurpleCoreDebugInit()");
     purple_debug_set_ui_ops(adium_purple_debug_get_ui_ops());
-#endif	
+
+	purple_debug_set_enabled(AIDebugLoggingIsEnabled());
 }
 
 static void associateLibpurpleAccounts(void)




More information about the commits mailing list