rhodes 7.4.1 → 7.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CREDITS +3 -1
- data/LICENSE +1 -1
- data/README.md +3 -1
- data/Rakefile +52 -43
- data/SECURITY.md +19 -0
- data/appveyor.yml +60 -7
- data/azure-pipelines.yml +67 -0
- data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/src/com/rhomobile/rhoelements/ans/ANSManager.java +2 -2
- data/lib/commonAPI/barcode/ext/platform/android/AndroidManifest.xml +3 -1
- data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/BarcodeCaptureActivity.java +11 -13
- data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/BarcodeGraphicTracker.java +1 -1
- data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/ui/camera/CameraSource.java +3 -3
- data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/ui/camera/CameraSourcePreview.java +1 -1
- data/lib/commonAPI/barcode/ext.yml +4 -8
- data/lib/commonAPI/coreapi/ext/platform/android/Rakefile +0 -12
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/Notification.java +4 -2
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationScheduler.java +3 -3
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +1 -1
- data/lib/commonAPI/coreapi/ext/push.xml +5 -2
- data/lib/commonAPI/mediacapture/ext/camera.xml +4 -9
- data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationFileProvider.erb +1 -1
- data/lib/commonAPI/mediacapture/ext/platform/android/ext_java.files +1 -9
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraExtension.java +0 -2
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraFactory.java +19 -24
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraObject.java +317 -729
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraRhoListener.java +240 -434
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/{CameraSingletonObject.java → CameraSingleton.java} +68 -74
- data/lib/commonAPI/printing_zebra/ext/platform/android/src/com/rhomobile/printing/zebra/impl/ZebraPrintingProviderImpl.java +2 -1
- data/lib/extensions/fcm-push/ext/android/ApplicationManifestAdds.erb +15 -17
- data/lib/extensions/fcm-push/ext/android/Rakefile +59 -34
- data/lib/extensions/fcm-push/ext/android/ext_java.files +0 -1
- data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMFacade.java +13 -17
- data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMIntentService.java +81 -80
- data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMListener.java +0 -16
- data/lib/extensions/fcm-push/ext.yml +1 -1
- data/lib/extensions/gmaps/ext/platform/android/ApplicationManifestAdds.erb +1 -0
- data/lib/extensions/gmaps/ext/platform/android/src/com/rhomobile/rhodes/gmaps/GMapActivity.java +12 -4
- data/lib/extensions/gmaps/ext.yml +3 -1
- data/platform/android/Rhodes/jni/src/MethodResultJni.cpp +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +3 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/StatusNotification.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +14 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +18 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality26.java +1 -1
- data/platform/android/build/{aab_builder.rb → aapt2_helper.rb} +94 -37
- data/platform/android/build/android.rake +124 -191
- data/platform/android/build/android_tools.rb +9 -9
- data/platform/android/build/androidcommon.rb +18 -7
- data/platform/android/build/build_tools_finder.rb +46 -0
- data/platform/android/build/config.yml +5 -0
- data/platform/android/build/dex_builder.rb +88 -0
- data/platform/android/build/hostplatform.rb +9 -0
- data/platform/android/build/manifest_generator.rb +1 -0
- data/platform/android/build/maven_deps_extractor.rb +22 -21
- data/platform/android/build/ndkwrapper.rb +80 -51
- data/platform/iphone/Classes/AppManager/AppManager.m +3 -1
- data/platform/iphone/Classes/Camera/PickImageDelegate.h +2 -0
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +45 -23
- data/platform/iphone/Classes/CocoaServer/CCocoaServer.h +27 -0
- data/platform/iphone/Classes/CocoaServer/CCocoaServer.m +107 -0
- data/platform/iphone/Classes/CocoaServer/RhoHTTPConnection.h +16 -0
- data/platform/iphone/Classes/CocoaServer/RhoHTTPConnection.m +226 -0
- data/platform/iphone/Classes/RhoWKWebView.mm +78 -11
- data/platform/iphone/Classes/RhoWebViewFabrique.m +6 -1
- data/platform/iphone/Classes/Rhodes.m +3 -0
- data/platform/iphone/CocoaHTTPServer/Core/Categories/DDData.h +14 -0
- data/platform/iphone/CocoaHTTPServer/Core/Categories/DDData.m +158 -0
- data/platform/iphone/CocoaHTTPServer/Core/Categories/DDNumber.h +12 -0
- data/platform/iphone/CocoaHTTPServer/Core/Categories/DDNumber.m +88 -0
- data/platform/iphone/CocoaHTTPServer/Core/Categories/DDRange.h +56 -0
- data/platform/iphone/CocoaHTTPServer/Core/Categories/DDRange.m +104 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h +45 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m +195 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPConnection.h +120 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPConnection.m +2708 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPLogging.h +136 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPMessage.h +48 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPMessage.m +113 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPResponse.h +149 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPServer.h +205 -0
- data/platform/iphone/CocoaHTTPServer/Core/HTTPServer.m +772 -0
- data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h +65 -0
- data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +529 -0
- data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h +33 -0
- data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +86 -0
- data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h +23 -0
- data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +211 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +75 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +405 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h +13 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m +79 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h +52 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.m +292 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h +9 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m +38 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h +25 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m +237 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h +12 -0
- data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m +73 -0
- data/platform/iphone/CocoaHTTPServer/Core/WebSocket.h +105 -0
- data/platform/iphone/CocoaHTTPServer/Core/WebSocket.m +791 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h +7 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m +160 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h +11 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +372 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h +7 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m +49 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h +8 -0
- data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m +69 -0
- data/platform/iphone/CocoaHTTPServer/LICENSE.txt +18 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/About.txt +4 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/GCDAsyncSocket.h +1226 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m +8528 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/About.txt +33 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDASLLogger.h +41 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDASLLogger.m +99 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.m +727 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDFileLogger.h +334 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDFileLogger.m +1353 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDLog.h +601 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDLog.m +1083 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDTTYLogger.h +167 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDTTYLogger.m +1479 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.h +65 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.m +191 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.h +116 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.m +251 -0
- data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/README.txt +7 -0
- data/platform/iphone/Framework/Rhodes/Rhodes.xcodeproj/project.pbxproj +1 -1
- data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +364 -0
- data/platform/iphone/rbuild/iphone.rake +4 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +0 -0
- data/platform/shared/common/RhodesApp.cpp +26 -1
- data/platform/shared/net/HttpServer.cpp +20 -0
- data/platform/shared/qt/RhoSimulator.pro +1 -1
- data/platform/shared/ruby/osx/ruby/config.h +2 -0
- data/platform/shared/ruby/win32/win32.c +10 -3
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/rakefile.rb +52 -43
- data/res/build-tools/RhoRuby.exe +0 -0
- data/res/build-tools/aapt2/linux/aapt2 +0 -0
- data/res/build-tools/aapt2/osx/aapt2 +0 -0
- data/res/generators/templates/application/AndroidManifest.erb +2 -1
- data/res/generators/templates/application/build.yml +4 -1
- data/res/generators/templates/application/rhoconfig.txt +5 -0
- data/rhobuild.yml.example +4 -4
- data/rhodes.gemspec +1 -2
- data/version +1 -1
- metadata +80 -35
- data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/drawable/camera_btn.xml +0 -14
- data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/layout/camera_land.xml +0 -23
- data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/layout/camera_port.xml +0 -23
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraActivity.java +0 -156
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraEclair.java +0 -227
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraGingerbread.java +0 -152
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraPreview.java +0 -183
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraSingletonEclair.java +0 -14
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraSingletonGingerbread.java +0 -60
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/ICameraObject.java +0 -20
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/ICameraSingletonObject.java +0 -8
- data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMTokenRefresherService.java +0 -27
- data/platform/android/Rhodes/AndroidManifest.xml.erb +0 -89
@@ -0,0 +1,334 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "DDLog.h"
|
3
|
+
|
4
|
+
@class DDLogFileInfo;
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Welcome to Cocoa Lumberjack!
|
8
|
+
*
|
9
|
+
* The project page has a wealth of documentation if you have any questions.
|
10
|
+
* https://github.com/robbiehanson/CocoaLumberjack
|
11
|
+
*
|
12
|
+
* If you're new to the project you may wish to read the "Getting Started" wiki.
|
13
|
+
* https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
|
14
|
+
*
|
15
|
+
*
|
16
|
+
* This class provides a logger to write log statements to a file.
|
17
|
+
**/
|
18
|
+
|
19
|
+
|
20
|
+
// Default configuration and safety/sanity values.
|
21
|
+
//
|
22
|
+
// maximumFileSize -> DEFAULT_LOG_MAX_FILE_SIZE
|
23
|
+
// rollingFrequency -> DEFAULT_LOG_ROLLING_FREQUENCY
|
24
|
+
// maximumNumberOfLogFiles -> DEFAULT_LOG_MAX_NUM_LOG_FILES
|
25
|
+
//
|
26
|
+
// You should carefully consider the proper configuration values for your application.
|
27
|
+
|
28
|
+
#define DEFAULT_LOG_MAX_FILE_SIZE (1024 * 1024) // 1 MB
|
29
|
+
#define DEFAULT_LOG_ROLLING_FREQUENCY (60 * 60 * 24) // 24 Hours
|
30
|
+
#define DEFAULT_LOG_MAX_NUM_LOG_FILES (5) // 5 Files
|
31
|
+
|
32
|
+
|
33
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
34
|
+
#pragma mark -
|
35
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
36
|
+
|
37
|
+
// The LogFileManager protocol is designed to allow you to control all aspects of your log files.
|
38
|
+
//
|
39
|
+
// The primary purpose of this is to allow you to do something with the log files after they have been rolled.
|
40
|
+
// Perhaps you want to compress them to save disk space.
|
41
|
+
// Perhaps you want to upload them to an FTP server.
|
42
|
+
// Perhaps you want to run some analytics on the file.
|
43
|
+
//
|
44
|
+
// A default LogFileManager is, of course, provided.
|
45
|
+
// The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property.
|
46
|
+
//
|
47
|
+
// This protocol provides various methods to fetch the list of log files.
|
48
|
+
//
|
49
|
+
// There are two variants: sorted and unsorted.
|
50
|
+
// If sorting is not necessary, the unsorted variant is obviously faster.
|
51
|
+
// The sorted variant will return an array sorted by when the log files were created,
|
52
|
+
// with the most recently created log file at index 0, and the oldest log file at the end of the array.
|
53
|
+
//
|
54
|
+
// You can fetch only the log file paths (full path including name), log file names (name only),
|
55
|
+
// or an array of DDLogFileInfo objects.
|
56
|
+
// The DDLogFileInfo class is documented below, and provides a handy wrapper that
|
57
|
+
// gives you easy access to various file attributes such as the creation date or the file size.
|
58
|
+
|
59
|
+
@protocol DDLogFileManager <NSObject>
|
60
|
+
@required
|
61
|
+
|
62
|
+
// Public properties
|
63
|
+
|
64
|
+
/**
|
65
|
+
* The maximum number of archived log files to keep on disk.
|
66
|
+
* For example, if this property is set to 3,
|
67
|
+
* then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk.
|
68
|
+
* Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted.
|
69
|
+
*
|
70
|
+
* You may optionally disable deleting old/rolled/archived log files by setting this property to zero.
|
71
|
+
**/
|
72
|
+
@property (readwrite, assign) NSUInteger maximumNumberOfLogFiles;
|
73
|
+
|
74
|
+
// Public methods
|
75
|
+
|
76
|
+
- (NSString *)logsDirectory;
|
77
|
+
|
78
|
+
- (NSArray *)unsortedLogFilePaths;
|
79
|
+
- (NSArray *)unsortedLogFileNames;
|
80
|
+
- (NSArray *)unsortedLogFileInfos;
|
81
|
+
|
82
|
+
- (NSArray *)sortedLogFilePaths;
|
83
|
+
- (NSArray *)sortedLogFileNames;
|
84
|
+
- (NSArray *)sortedLogFileInfos;
|
85
|
+
|
86
|
+
// Private methods (only to be used by DDFileLogger)
|
87
|
+
|
88
|
+
- (NSString *)createNewLogFile;
|
89
|
+
|
90
|
+
@optional
|
91
|
+
|
92
|
+
// Notifications from DDFileLogger
|
93
|
+
|
94
|
+
- (void)didArchiveLogFile:(NSString *)logFilePath;
|
95
|
+
- (void)didRollAndArchiveLogFile:(NSString *)logFilePath;
|
96
|
+
|
97
|
+
@end
|
98
|
+
|
99
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
100
|
+
#pragma mark -
|
101
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Default log file manager.
|
105
|
+
*
|
106
|
+
* All log files are placed inside the logsDirectory.
|
107
|
+
* If a specific logsDirectory isn't specified, the default directory is used.
|
108
|
+
* On Mac, this is in ~/Library/Logs/<Application Name>.
|
109
|
+
* On iPhone, this is in ~/Library/Caches/Logs.
|
110
|
+
*
|
111
|
+
* Log files are named "log-<uuid>.txt",
|
112
|
+
* where uuid is a 6 character hexadecimal consisting of the set [0123456789ABCDEF].
|
113
|
+
*
|
114
|
+
* Archived log files are automatically deleted according to the maximumNumberOfLogFiles property.
|
115
|
+
**/
|
116
|
+
@interface DDLogFileManagerDefault : NSObject <DDLogFileManager>
|
117
|
+
{
|
118
|
+
NSUInteger maximumNumberOfLogFiles;
|
119
|
+
NSString *_logsDirectory;
|
120
|
+
}
|
121
|
+
|
122
|
+
- (id)init;
|
123
|
+
- (id)initWithLogsDirectory:(NSString *)logsDirectory;
|
124
|
+
|
125
|
+
/* Inherited from DDLogFileManager protocol:
|
126
|
+
|
127
|
+
@property (readwrite, assign) NSUInteger maximumNumberOfLogFiles;
|
128
|
+
|
129
|
+
- (NSString *)logsDirectory;
|
130
|
+
|
131
|
+
- (NSArray *)unsortedLogFilePaths;
|
132
|
+
- (NSArray *)unsortedLogFileNames;
|
133
|
+
- (NSArray *)unsortedLogFileInfos;
|
134
|
+
|
135
|
+
- (NSArray *)sortedLogFilePaths;
|
136
|
+
- (NSArray *)sortedLogFileNames;
|
137
|
+
- (NSArray *)sortedLogFileInfos;
|
138
|
+
|
139
|
+
*/
|
140
|
+
|
141
|
+
@end
|
142
|
+
|
143
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
144
|
+
#pragma mark -
|
145
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
146
|
+
|
147
|
+
/**
|
148
|
+
* Most users will want file log messages to be prepended with the date and time.
|
149
|
+
* Rather than forcing the majority of users to write their own formatter,
|
150
|
+
* we will supply a logical default formatter.
|
151
|
+
* Users can easily replace this formatter with their own by invoking the setLogFormatter method.
|
152
|
+
* It can also be removed by calling setLogFormatter, and passing a nil parameter.
|
153
|
+
*
|
154
|
+
* In addition to the convenience of having a logical default formatter,
|
155
|
+
* it will also provide a template that makes it easy for developers to copy and change.
|
156
|
+
**/
|
157
|
+
@interface DDLogFileFormatterDefault : NSObject <DDLogFormatter>
|
158
|
+
{
|
159
|
+
NSDateFormatter *dateFormatter;
|
160
|
+
}
|
161
|
+
|
162
|
+
- (id)init;
|
163
|
+
- (id)initWithDateFormatter:(NSDateFormatter *)dateFormatter;
|
164
|
+
|
165
|
+
@end
|
166
|
+
|
167
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
168
|
+
#pragma mark -
|
169
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
170
|
+
|
171
|
+
@interface DDFileLogger : DDAbstractLogger <DDLogger>
|
172
|
+
{
|
173
|
+
__strong id <DDLogFileManager> logFileManager;
|
174
|
+
|
175
|
+
DDLogFileInfo *currentLogFileInfo;
|
176
|
+
NSFileHandle *currentLogFileHandle;
|
177
|
+
|
178
|
+
dispatch_source_t rollingTimer;
|
179
|
+
|
180
|
+
unsigned long long maximumFileSize;
|
181
|
+
NSTimeInterval rollingFrequency;
|
182
|
+
}
|
183
|
+
|
184
|
+
- (id)init;
|
185
|
+
- (id)initWithLogFileManager:(id <DDLogFileManager>)logFileManager;
|
186
|
+
|
187
|
+
/**
|
188
|
+
* Log File Rolling:
|
189
|
+
*
|
190
|
+
* maximumFileSize:
|
191
|
+
* The approximate maximum size to allow log files to grow.
|
192
|
+
* If a log file is larger than this value after a log statement is appended,
|
193
|
+
* then the log file is rolled.
|
194
|
+
*
|
195
|
+
* rollingFrequency
|
196
|
+
* How often to roll the log file.
|
197
|
+
* The frequency is given as an NSTimeInterval, which is a double that specifies the interval in seconds.
|
198
|
+
* Once the log file gets to be this old, it is rolled.
|
199
|
+
*
|
200
|
+
* Both the maximumFileSize and the rollingFrequency are used to manage rolling.
|
201
|
+
* Whichever occurs first will cause the log file to be rolled.
|
202
|
+
*
|
203
|
+
* For example:
|
204
|
+
* The rollingFrequency is 24 hours,
|
205
|
+
* but the log file surpasses the maximumFileSize after only 20 hours.
|
206
|
+
* The log file will be rolled at that 20 hour mark.
|
207
|
+
* A new log file will be created, and the 24 hour timer will be restarted.
|
208
|
+
*
|
209
|
+
* You may optionally disable rolling due to filesize by setting maximumFileSize to zero.
|
210
|
+
* If you do so, rolling is based solely on rollingFrequency.
|
211
|
+
*
|
212
|
+
* You may optionally disable rolling due to time by setting rollingFrequency to zero (or any non-positive number).
|
213
|
+
* If you do so, rolling is based solely on maximumFileSize.
|
214
|
+
*
|
215
|
+
* If you disable both maximumFileSize and rollingFrequency, then the log file won't ever be rolled.
|
216
|
+
* This is strongly discouraged.
|
217
|
+
**/
|
218
|
+
@property (readwrite, assign) unsigned long long maximumFileSize;
|
219
|
+
@property (readwrite, assign) NSTimeInterval rollingFrequency;
|
220
|
+
|
221
|
+
/**
|
222
|
+
* The DDLogFileManager instance can be used to retrieve the list of log files,
|
223
|
+
* and configure the maximum number of archived log files to keep.
|
224
|
+
*
|
225
|
+
* @see DDLogFileManager.maximumNumberOfLogFiles
|
226
|
+
**/
|
227
|
+
@property (strong, nonatomic, readonly) id <DDLogFileManager> logFileManager;
|
228
|
+
|
229
|
+
|
230
|
+
// You can optionally force the current log file to be rolled with this method.
|
231
|
+
|
232
|
+
- (void)rollLogFile;
|
233
|
+
|
234
|
+
// Inherited from DDAbstractLogger
|
235
|
+
|
236
|
+
// - (id <DDLogFormatter>)logFormatter;
|
237
|
+
// - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
|
238
|
+
|
239
|
+
@end
|
240
|
+
|
241
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
242
|
+
#pragma mark -
|
243
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
244
|
+
|
245
|
+
/**
|
246
|
+
* DDLogFileInfo is a simple class that provides access to various file attributes.
|
247
|
+
* It provides good performance as it only fetches the information if requested,
|
248
|
+
* and it caches the information to prevent duplicate fetches.
|
249
|
+
*
|
250
|
+
* It was designed to provide quick snapshots of the current state of log files,
|
251
|
+
* and to help sort log files in an array.
|
252
|
+
*
|
253
|
+
* This class does not monitor the files, or update it's cached attribute values if the file changes on disk.
|
254
|
+
* This is not what the class was designed for.
|
255
|
+
*
|
256
|
+
* If you absolutely must get updated values,
|
257
|
+
* you can invoke the reset method which will clear the cache.
|
258
|
+
**/
|
259
|
+
@interface DDLogFileInfo : NSObject
|
260
|
+
{
|
261
|
+
__strong NSString *filePath;
|
262
|
+
__strong NSString *fileName;
|
263
|
+
|
264
|
+
__strong NSDictionary *fileAttributes;
|
265
|
+
|
266
|
+
__strong NSDate *creationDate;
|
267
|
+
__strong NSDate *modificationDate;
|
268
|
+
|
269
|
+
unsigned long long fileSize;
|
270
|
+
}
|
271
|
+
|
272
|
+
@property (strong, nonatomic, readonly) NSString *filePath;
|
273
|
+
@property (strong, nonatomic, readonly) NSString *fileName;
|
274
|
+
|
275
|
+
@property (strong, nonatomic, readonly) NSDictionary *fileAttributes;
|
276
|
+
|
277
|
+
@property (strong, nonatomic, readonly) NSDate *creationDate;
|
278
|
+
@property (strong, nonatomic, readonly) NSDate *modificationDate;
|
279
|
+
|
280
|
+
@property (nonatomic, readonly) unsigned long long fileSize;
|
281
|
+
|
282
|
+
@property (nonatomic, readonly) NSTimeInterval age;
|
283
|
+
|
284
|
+
@property (nonatomic, readwrite) BOOL isArchived;
|
285
|
+
|
286
|
+
+ (id)logFileWithPath:(NSString *)filePath;
|
287
|
+
|
288
|
+
- (id)initWithFilePath:(NSString *)filePath;
|
289
|
+
|
290
|
+
- (void)reset;
|
291
|
+
- (void)renameFile:(NSString *)newFileName;
|
292
|
+
|
293
|
+
#if TARGET_IPHONE_SIMULATOR
|
294
|
+
|
295
|
+
// So here's the situation.
|
296
|
+
// Extended attributes are perfect for what we're trying to do here (marking files as archived).
|
297
|
+
// This is exactly what extended attributes were designed for.
|
298
|
+
//
|
299
|
+
// But Apple screws us over on the simulator.
|
300
|
+
// Everytime you build-and-go, they copy the application into a new folder on the hard drive,
|
301
|
+
// and as part of the process they strip extended attributes from our log files.
|
302
|
+
// Normally, a copy of a file preserves extended attributes.
|
303
|
+
// So obviously Apple has gone to great lengths to piss us off.
|
304
|
+
//
|
305
|
+
// Thus we use a slightly different tactic for marking log files as archived in the simulator.
|
306
|
+
// That way it "just works" and there's no confusion when testing.
|
307
|
+
//
|
308
|
+
// The difference in method names is indicative of the difference in functionality.
|
309
|
+
// On the simulator we add an attribute by appending a filename extension.
|
310
|
+
//
|
311
|
+
// For example:
|
312
|
+
// log-ABC123.txt -> log-ABC123.archived.txt
|
313
|
+
|
314
|
+
- (BOOL)hasExtensionAttributeWithName:(NSString *)attrName;
|
315
|
+
|
316
|
+
- (void)addExtensionAttributeWithName:(NSString *)attrName;
|
317
|
+
- (void)removeExtensionAttributeWithName:(NSString *)attrName;
|
318
|
+
|
319
|
+
#else
|
320
|
+
|
321
|
+
// Normal use of extended attributes used everywhere else,
|
322
|
+
// such as on Macs and on iPhone devices.
|
323
|
+
|
324
|
+
- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName;
|
325
|
+
|
326
|
+
- (void)addExtendedAttributeWithName:(NSString *)attrName;
|
327
|
+
- (void)removeExtendedAttributeWithName:(NSString *)attrName;
|
328
|
+
|
329
|
+
#endif
|
330
|
+
|
331
|
+
- (NSComparisonResult)reverseCompareByCreationDate:(DDLogFileInfo *)another;
|
332
|
+
- (NSComparisonResult)reverseCompareByModificationDate:(DDLogFileInfo *)another;
|
333
|
+
|
334
|
+
@end
|