mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-15 16:11:42 +00:00
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:
parent
258efaeaf7
commit
cc233b6ba0
1 changed files with 22 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue