洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.8 KiB

8 months ago
  1. //
  2. // APRemoteLogManager.h
  3. // APRemoteLogging
  4. //
  5. // Created by tashigaofei on 14-6-23.
  6. // Copyright (c) 2014年 DTF. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "DTFLogFile.h"
  10. #import "DTFLogFormatter.h"
  11. typedef void (^NetworkUploadCompletion)(BOOL);
  12. typedef void (^NetworkUploadBlock)(NSDictionary *,NetworkUploadCompletion);
  13. @class MPLoggingContext;
  14. @interface DTFLogManager : NSObject
  15. @property(nonatomic, copy) NetworkUploadBlock networkUploadBlock;
  16. typedef void (^LogCallback)(NSDictionary *logData);
  17. +(instancetype)sharedInstance;
  18. + (void)setLogCallback:(LogCallback)logCallback;
  19. -(void)writeLogWithContext:(MPLoggingContext *) context;
  20. -(void)flushAllLog;
  21. -(void)setupTimeForCheckFileSize;
  22. -(void)checkLogs;
  23. - (void)startUploadLog;
  24. @end
  25. @interface MPLoggingContext : NSObject
  26. @property (nonatomic, assign) MPLogType logType;
  27. @property (nonatomic, strong) DTFLogFormatter *formatter;
  28. @property (nonatomic, strong) NSMutableDictionary * logDict;
  29. @property (nonatomic, strong) NSString *bizType;
  30. @end
  31. NSString * MPLogPathForFile(NSString * name);
  32. DTFLogFile* DTFLogFileForContext(MPLoggingContext *context);
  33. NSData* MPLogRSAEncrypt(NSData * data);
  34. NSString*MPLogAESEncrypt(NSString *key, NSString *data);
  35. NSString* MPLogBase64EncodedString(NSData *data, int wrapWidth);
  36. NSData*MPLogBase64DecodedString(NSString *string);
  37. NSString* MPLogMD5String(NSString *string);
  38. NSData* MPLogGZipCompress(NSData *data);
  39. NSString* MPLogGetNetworkName();
  40. NSString *MPLogGetCarrierName();
  41. typedef enum : NSInteger {
  42. MPLogNotReachable = 0,
  43. MPLogReachableViaWiFi,
  44. MPLogReachableViaWWAN
  45. } MPLogNetworkStatus;
  46. @interface MPSafeMap : NSObject
  47. - (id)objectForKeyedSubscript:(id <NSCopying>)key;
  48. - (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key;
  49. - (void)removeObjectForKey:(id)aKey;
  50. @end