Permalink
Browse files

Disabled reporting of handler enable/disable for error presenter (sin…

…ce that would result in an alert showing).
  • Loading branch information...
1 parent a3de162 commit aae3c356ecde775279e38cd503b932a2d4ed000f @samdeane samdeane committed Apr 10, 2012
@@ -90,7 +90,7 @@ + (void)reportResult:(BOOL)didSucceed error:(NSError*) error message:(NSString*)
{
va_list args;
va_start(args, message);
- [self reportError:error format:message arguments:args assertInDebug:YES];
+ [self reportError:error format:message arguments:args assertInDebug:NO];
va_end(args);
}
}
@@ -107,7 +107,7 @@ + (void)reportResult:(BOOL)didSucceed message:(NSString*)message, ...
{
va_list args;
va_start(args, message);
- [self reportError:nil format:message arguments:args assertInDebug:YES];
+ [self reportError:nil format:message arguments:args assertInDebug:NO];
va_end(args);
}
}
@@ -124,7 +124,7 @@ + (void)reportStatus:(OSStatus)status message:(NSString*)message, ...
{
va_list args;
va_start(args, message);
- [self reportError:nil format:message arguments:args assertInDebug:YES];
+ [self reportError:nil format:message arguments:args assertInDebug:NO];
va_end(args);
}
}
@@ -141,7 +141,7 @@ + (void)reportError:(NSError*) error message:(NSString*)message, ...
{
va_list args;
va_start(args, message);
- [self reportError:error format:message arguments:args assertInDebug:YES];
+ [self reportError:error format:message arguments:args assertInDebug:NO];
va_end(args);
}
}
@@ -111,8 +111,7 @@ - (void) enableHandler: (ECLogHandler*)handler
[self.handlers addObject:handler];
}
- ECMakeContext();
- logToChannel(self, &ecLogContext, @"Enabled handler %@", handler.name);
+ [handler wasEnabledForChannel:self];
}
// --------------------------------------------------------------------------
@@ -121,8 +120,8 @@ - (void) enableHandler: (ECLogHandler*)handler
- (void) disableHandler: (ECLogHandler*) handler
{
- ECMakeContext();
- logToChannel(self, &ecLogContext, @"Disabled handler %@", handler.name);
+ [handler wasDisabledForChannel:self];
+
if (!self.handlers)
{
ECLogManager* lm = [ECLogManager sharedInstance];
@@ -22,4 +22,6 @@
- (void)logFromChannel:(ECLogChannel*)channel withObject:(id)object arguments:(va_list)arguments context:(ECLogContext*)context;
- (NSComparisonResult)caseInsensitiveCompare:(ECLogHandler*)other;
- (NSString*)simpleOutputStringForChannel:(ECLogChannel*)channel withObject:(id)object arguments:(va_list)arguments context:(ECLogContext*)context;
+- (void)wasEnabledForChannel:(ECLogChannel*)channel;
+- (void)wasDisabledForChannel:(ECLogChannel*)channel;
@end
@@ -91,4 +91,28 @@ - (NSString*)simpleOutputStringForChannel:(ECLogChannel*)channel withObject:(id)
return result;
}
+#pragma mark - Default Enabled/Disabled Notifications
+
+// --------------------------------------------------------------------------
+//! Indicate that the handler was enabled for a given channel.
+//! By default we just log the fact to the channel.
+// --------------------------------------------------------------------------
+
+- (void)wasEnabledForChannel:(ECLogChannel *)channel
+{
+ ECMakeContext();
+ logToChannel(channel, &ecLogContext, @"Enabled handler %@", self.name);
+}
+
+// --------------------------------------------------------------------------
+//! Indicate that the handler was disabled for a given channel.
+//! By default we just log the fact to the channel.
+// --------------------------------------------------------------------------
+
+- (void)wasDisabledForChannel:(ECLogChannel *)channel
+{
+ ECMakeContext();
+ logToChannel(channel, &ecLogContext, @"Disabled handler %@", self.name);
+}
+
@end
@@ -52,4 +52,26 @@ - (void)logFromChannel:(ECLogChannel*)channel withObject:(id)object arguments:(v
[[NSApplication sharedApplication] presentError:error];
}
+// --------------------------------------------------------------------------
+//! Called to indicate that the handler was enabled for a given channel.
+//! We don't want to do the default thing here - which would have been
+//! to log the information to the channel, since that would cause us
+//! to display an error alert which we only want to do for actual errors.
+// --------------------------------------------------------------------------
+
+- (void)wasEnabledForChannel:(ECLogChannel *)channel
+{
+}
+
+// --------------------------------------------------------------------------
+//! Called to indicate that the handler was disabled for a given channel.
+//! We don't want to do the default thing here - which would have been
+//! to log the information to the channel, since that would cause us
+//! to display an error alert which we only want to do for actual errors.
+// --------------------------------------------------------------------------
+
+- (void)wasDisabledForChannel:(ECLogChannel *)channel
+{
+}
+
@end

0 comments on commit aae3c35

Please sign in to comment.