DJLogging is a Swift library for iPhone / iPad and Mac. It allows you to log points in code with associated data so if a user of your app contacts you you will have more information to help.
Fully compatible with both Swift and Objective-C projects
Use my iOS LogViewer app to easily read the logs on an iOS device
Simply use SPM to add the package ddaddy/DJLogging-Swift.git
Install Carthage if not already available
Change to the directory of your Xcode project, and Create and Edit your Cartfile and add DJLogging:
$ cd /path/to/MyProject
$ touch Cartfile
$ open Cartfile
github "ddaddy/DJLogging-Swift.git" ~> 1.0
Save and run:
$ carthage update
Drop the Carthage/Build/iOS .framework in your project.
For more details on Cartage and how to use it, check the Carthage Github documentation
LogMethodCall(type: DJLogType = .standard)
LogMethodCall(_ param: String? = nil, type: DJLogType = .standard)
LogMethodCall(_ param: Double? = nil, type: DJLogType = .standard)
LogMethodCall(_ param: Int? = nil, type: DJLogType = .standard)
LogMethodCall(_ uuid: UUID?, type: DJLogType = .standard)
LogMethodCall(_ uuid: UUID?, logs: [String], type: DJLogType = .standard)
LogRequestResponse(uuid: UUID?, response: URLResponse?, data: Data?, error: Error?, type: DJLogType = .standard)
func htmlString() -> String
func htmlData() -> Data
func clearLog()
class DJLogTypeComms: DJLogType {
static var shared: DJLogType = DJLogTypeComms()
var id: UUID = UUID()
var name: String = "comms"
var colour: DJColor = DJColours.orange
}
extension DJLogType where Self == DJLogTypeComms {
static var comms: DJLogType { DJLogTypeComms.shared }
}
LogMethodCall
LogMethodCallWithType(<DJLogType>*)
LogMethodCallWithUUID(NSUUID *)
LogMethodCallWithUUIDAndType(NSUUID*, <DJLogType>*)
LogRequestResponseWithUUID(NSUUID *)
LogRequestResponseWithUUIDAndType(NSUUID *, <DJLogType>*)
[LogManager sharedInstance]
+ (void)logTitle:(NSString * _Nonnull) log:(NSString * _Nullable) uuid:(NSUUID * _Nullable) type:(id<DJLogType> _Nonnull)
+ (void)logRequestResponse:(NSURLResponse * _Nullable) data:(NSData * _Nullable) error:(NSError * _Nullable) uuid:(NSUUID * _Nullable) type:(id<DJLogType> _Nonnull)
+ (NSString *)htmlString;
+ (NSData *)htmlData;
+ (void)clearLog;
@interface DJLogTypeComms : NSObject <DJLogType>
@end
@implementation DJLogTypeComms
static DJLogTypeComms *_sharedInstance = nil;
static NSUUID *_uuid = nil;
+ (id<DJLogType> _Nonnull)shared {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedInstance = [[self alloc] init];
});
return _sharedInstance;
}
- (NSUUID *)id {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_uuid = [[NSUUID alloc] init];
});
return _uuid;
}
- (NSString *)name { return @"comms"; }
- (UIColor *)colour { return [DJColours orange]; }
@end
Copyright (c) 2019 Darren Jones (Dappological Ltd.)
link |
Stars: 0 |
Last commit: 6 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics