Permalink
Browse files

Adding sample implementation of a CoreDataLogger.

  • Loading branch information...
robbiehanson committed Mar 30, 2011
1 parent 2e9c50a commit fd0e8cef9db876b56c4c2f6fe23c5bd020a97061

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.deusty.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>${MACOSX_DEPLOYMENT_TARGET}</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'CoreDataLogger' target in the 'CoreDataLogger' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
@@ -0,0 +1,41 @@
+#import <Foundation/Foundation.h>
+#import "DDAbstractDatabaseLogger.h"
+
+
+@interface CoreDataLogger : DDAbstractDatabaseLogger <DDLogger>
+{
+ @private
+ NSString *logDirectory;
+
+ NSManagedObjectModel *managedObjectModel;
+ NSPersistentStoreCoordinator *persistentStoreCoordinator;
+ NSManagedObjectContext *managedObjectContext;
+ NSEntityDescription *logEntryEntity;
+}
+
+/**
+ * Initializes an instance set to save it's CocoaBotLog.sqlite file to the given directory.
+ * If the directory doesn't already exist, it is automatically created.
+**/
+- (id)initWithLogDirectory:(NSString *)logDirectory;
+
+/**
+ * Provides access to the thread-safe components of the core data stack.
+ *
+ * Please note that NSManagedObjectContext is NOT thread-safe.
+ * The managedObjectContext in use by this instance is only to be used on it's private dispatch_queue.
+ * You must create your own managedObjectContext for your own use.
+**/
+@property (readonly) NSManagedObjectModel *managedObjectModel;
+@property (readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
+
+/**
+ * Clears the log by removing the persistentStore from the persistentStoreCoordinator,
+ * and deleting the Log.sqlite file from disk.
+ *
+ * Important: If you have created your own managedObjectContext for the Log,
+ * you MUST reset your context following an invocation of this method!
+**/
+- (void)clearLog;
+
+@end
Oops, something went wrong.

0 comments on commit fd0e8ce

Please sign in to comment.