log notifications

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28896 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-10-27 12:42:10 +00:00
parent 258efaeaf7
commit cc233b6ba0

View file

@ -27,6 +27,17 @@
#import <Performance/GSCache.h>
#import "SQLClient.h"
@interface Logger : NSObject
- (void) notified: (NSNotification*)n;
@end
@implementation Logger
- (void) notified: (NSNotification*)n
{
NSLog(@"Received %@", n);
}
@end
int
main()
{
@ -39,6 +50,7 @@ main()
unsigned int i;
NSData *data;
NSString *name;
Logger *l;
defs = [NSUserDefaults standardUserDefaults];
[defs registerDefaults:
@ -58,6 +70,16 @@ main()
db = [SQLClient clientWithConfiguration: nil name: @"test"];
l = [Logger new];
[[NSNotificationCenter defaultCenter] addObserver: l
selector: @selector(notified:)
name: SQLClientDidConnectNotification
object: db];
[[NSNotificationCenter defaultCenter] addObserver: l
selector: @selector(notified:)
name: SQLClientDidDisconnectNotification
object: db];
if ((name = [defs stringForKey: @"Producer"]) != nil)
{
NS_DURING