/
CoreDataLogger.h
41 lines (34 loc) · 1.34 KB
/
CoreDataLogger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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