Skip to content

Commit 20ec370

Browse files
committed
Initial commit
LLDebugTool is a debugging tool for developers and testers that can help you analyze and manipulate data in non-xcode situations.
1 parent cca49bb commit 20ec370

File tree

308 files changed

+29181
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+29181
-1
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## [1.0.0](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.0.0) (05/09/2018)
2+
3+
* Initial release version.
4+
* Contains the following functions:
5+
 
6+
* Monitoring network requests.
7+
* Save and view log information.
8+
* Crash information collection.
9+
* Monitoring app properties.
10+
* Operation of sandbox file.
11+

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

LLDebugTool.podspec

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Pod::Spec.new do |s|
2+
s.name = "LLDebugTool"
3+
s.version = "1.0.0"
4+
s.summary = "LLDebugTool is a debugging tool for developers and testers that can help you analyze and manipulate data in non-xcode situations."
5+
s.homepage = "https://github.com/HDB-Li/LLDebugTool"
6+
s.license = "MIT"
7+
s.author = { "HDB-Li" => "[email protected]" }
8+
s.social_media_url = "https://github.com/HDB-Li"
9+
s.platform = :ios, "9.0"
10+
s.source = { :git => "https://github.com/HDB-Li/LLDebugTool.git", :tag => s.version }
11+
s.requires_arc = true
12+
s.source_files = "LLDebugTool/**/*.{h,m}"
13+
s.resources = "LLDebugTool/**/*.{xib,storyboard,bundle}"
14+
s.dependency "FMDB"
15+
16+
end

LLDebugTool/Config/LLConfig.h

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
//
2+
// LLConfig.h
3+
//
4+
// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
24+
#import <Foundation/Foundation.h>
25+
#import <UIKit/UIKit.h>
26+
27+
#ifndef LLCONFIG_CUSTOM_COLOR
28+
#define LLCONFIG_CUSTOM_COLOR ([LLConfig sharedConfig].useSystemColor == NO)
29+
#define LLCONFIG_TEXT_COLOR [LLConfig sharedConfig].textColor
30+
#define LLCONFIG_BACKGROUND_COLOR [LLConfig sharedConfig].backgroundColor
31+
#endif
32+
33+
34+
/**
35+
Color style enum
36+
37+
- LLConfigColorStyleHack: Green backgroundColor and white textColor.
38+
- LLConfigColorStyleSimple: White backgroundColor and darkTextColor textColor.
39+
- LLConfigColorStyleSystem: White backgroundColor and system tint textColor.
40+
*/
41+
typedef NS_ENUM(NSUInteger, LLConfigColorStyle) {
42+
LLConfigColorStyleHack,
43+
LLConfigColorStyleSimple,
44+
LLConfigColorStyleSystem,
45+
};
46+
47+
/**
48+
Log Level. It can be used for filter.
49+
50+
- LLConfigLogLevelDefault: Use to save message or note.
51+
- LLConfigLogLevelAlert: Use to save alert message.
52+
- LLConfigLogLevelWarning: Use to save warning message.
53+
- LLConfigLogLevelError: Use to save error message.
54+
*/
55+
typedef NS_ENUM(NSUInteger, LLConfigLogLevel) {
56+
LLConfigLogLevelDefault,
57+
LLConfigLogLevelAlert,
58+
LLConfigLogLevelWarning,
59+
LLConfigLogLevelError,
60+
};
61+
62+
/**
63+
Config file. Must config properties before [LLDebugTool enable].
64+
*/
65+
@interface LLConfig : NSObject
66+
67+
/**
68+
Singleton to get/save config.
69+
70+
@return Singleton
71+
*/
72+
+ (instancetype _Nonnull)sharedConfig;
73+
74+
#pragma mark - StautsBarSytle
75+
/**
76+
Window's statusBarStyle when show.
77+
*/
78+
@property (assign , nonatomic , readonly) UIStatusBarStyle statusBarStyle;
79+
80+
#pragma mark - Color
81+
/**
82+
Use preset the color configuration. For details, please see LLConfigColorStyle.
83+
*/
84+
@property (assign , nonatomic) LLConfigColorStyle colorStyle;
85+
86+
/**
87+
UIControl's background color. Default is [UIColor blackColor]. Set this property will also change useSystemColor to NO.
88+
*/
89+
@property (strong , nonatomic , nonnull , readonly) UIColor *backgroundColor;
90+
91+
/**
92+
UIControl's text color. Default is [UIColor greenColor]. Set this property will also change useSystemColor to NO.
93+
*/
94+
@property (strong , nonatomic , nonnull , readonly) UIColor *textColor;
95+
96+
/**
97+
Use system color or not. If YES, window will draw by system tint color. If NO, window will draw by [backgroundColor] and [textColor].
98+
Default is NO.
99+
*/
100+
@property (assign , nonatomic) BOOL useSystemColor;
101+
102+
/**
103+
System tint color.
104+
*/
105+
@property (strong , nonatomic , readonly , nonnull) UIColor *systemTintColor;
106+
107+
/**
108+
Customizing the custom color configuration.
109+
*/
110+
- (void)configBackgroundColor:(UIColor *_Nonnull)backgroundColor textColor:(UIColor *_Nonnull)textColor statusBarStyle:(UIStatusBarStyle)statusBarStyle;
111+
112+
#pragma mark - Date Formatter
113+
/**
114+
Date Format Style. Use to recording time when create model. Default is "yyyy-MM-dd HH:mm:ss".
115+
If this value is modified, the old data is not compatible.
116+
*/
117+
@property (copy , nonatomic , nonnull) NSString *dateFormatter;
118+
119+
#pragma mark - Window
120+
/**
121+
Suspension ball width, must greater than 70.
122+
*/
123+
@property (assign , nonatomic) CGFloat suspensionBallWidth;
124+
125+
/**
126+
Suspension Ball alpha(not active), default is 0.9.
127+
*/
128+
@property (assign , nonatomic) CGFloat normalAlpha;
129+
130+
/**
131+
Suspension Ball alpha(active), default is 1.0.
132+
*/
133+
@property (assign , nonatomic) CGFloat activeAlpha;
134+
135+
/**
136+
Whether the suspension ball can be moved, default is YES.
137+
*/
138+
@property (assign , nonatomic) BOOL suspensionBallMoveable;
139+
140+
#pragma mark - User Identity
141+
/**
142+
Tag user name is used to create the crash/network/log model.
143+
*/
144+
@property (copy , nonatomic , nullable) NSString *userIdentity;
145+
146+
#pragma mark - Network
147+
/**
148+
Observer network in hosts, ignore others.
149+
*/
150+
@property (strong , nonatomic , nullable) NSArray <NSString *>*hosts;
151+
152+
#pragma mark - Extension
153+
/**
154+
Image resource bundle name.
155+
*/
156+
@property (copy , nonatomic , readonly , nonnull) NSString *bundlePath;
157+
158+
@end

LLDebugTool/Config/LLConfig.m

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
//
2+
// LLConfig.m
3+
//
4+
// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
24+
#import "LLConfig.h"
25+
26+
static LLConfig *_instance = nil;
27+
28+
@implementation LLConfig
29+
30+
+ (instancetype)sharedConfig {
31+
static dispatch_once_t onceToken;
32+
dispatch_once(&onceToken, ^{
33+
_instance = [[LLConfig alloc] init];
34+
[_instance initial];
35+
});
36+
return _instance;
37+
}
38+
39+
- (void)setColorStyle:(LLConfigColorStyle)colorStyle {
40+
// if (_colorStyle != colorStyle) {
41+
_colorStyle = colorStyle;
42+
_useSystemColor = NO;
43+
[self updateColor];
44+
// }
45+
}
46+
47+
- (void)configBackgroundColor:(UIColor *)backgroundColor textColor:(UIColor *)textColor statusBarStyle:(UIStatusBarStyle)statusBarStyle {
48+
_useSystemColor = NO;
49+
_backgroundColor = backgroundColor;
50+
_textColor = textColor;
51+
_statusBarStyle = statusBarStyle;
52+
}
53+
54+
#pragma mark - Primary
55+
/**
56+
Initialize something.
57+
*/
58+
- (void)initial {
59+
// Set default values
60+
_bundlePath = @"LLDebugTool.bundle";
61+
_dateFormatter = @"yyyy-MM-dd HH:mm:ss";
62+
_systemTintColor = [[UIView alloc] init].tintColor;
63+
_colorStyle = LLConfigColorStyleHack;
64+
_suspensionBallWidth = 70;
65+
_normalAlpha = 0.9;
66+
_activeAlpha = 1.0;
67+
_suspensionBallMoveable = YES;
68+
[self updateColor];
69+
}
70+
71+
- (void)updateColor {
72+
switch (self.colorStyle) {
73+
case LLConfigColorStyleSimple:{
74+
_backgroundColor = [UIColor colorWithWhite:0.95 alpha:1];
75+
_textColor = [UIColor darkTextColor];
76+
_statusBarStyle = UIStatusBarStyleDefault;
77+
}
78+
break;
79+
case LLConfigColorStyleSystem: {
80+
_backgroundColor = [UIColor whiteColor];
81+
_textColor = self.systemTintColor;
82+
_statusBarStyle = UIStatusBarStyleDefault;
83+
}
84+
break;
85+
case LLConfigColorStyleHack:
86+
default:{
87+
_backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:1];
88+
_textColor = [UIColor greenColor];
89+
_statusBarStyle = UIStatusBarStyleLightContent;
90+
}
91+
break;
92+
}
93+
}
94+
95+
@end
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
//
2+
// LLDebugTool.h
3+
//
4+
// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
24+
#import <Foundation/Foundation.h>
25+
#import "LLConfig.h"
26+
27+
#ifndef LLSharedDebugTool
28+
#define LLSharedDebugTool [LLDebugTool sharedTool]
29+
#define LLog(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelDefault onEvent:nil message:(fmt, ##__VA_ARGS__)]
30+
#define LLog_Event(event , fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelDefault onEvent:event message:(fmt, ##__VA_ARGS__)]
31+
#define LLog_Alert(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelAlert onEvent:nil message:(fmt, ##__VA_ARGS__)]
32+
#define LLog_Alert_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelAlert onEvent:event message:(fmt, ##__VA_ARGS__)]
33+
#define LLog_Warning(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelWarning onEvent:nil message:(fmt, ##__VA_ARGS__)]
34+
#define LLog_Warning_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelWarning onEvent:event message:(fmt, ##__VA_ARGS__)]
35+
#define LLog_Error(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelError onEvent:nil message:(fmt, ##__VA_ARGS__)]
36+
#define LLog_Error_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelError onEvent:event message:(fmt, ##__VA_ARGS__)]
37+
#endif
38+
39+
@class LLWindow;
40+
41+
/**
42+
Control whether DebugTool is started.
43+
*/
44+
@interface LLDebugTool : NSObject
45+
46+
/**
47+
Suspension ball window.
48+
*/
49+
@property (nonatomic , strong , readonly) LLWindow *window;
50+
51+
/**
52+
Singleton to control debugTool.
53+
54+
@return Singleton
55+
*/
56+
+ (instancetype)sharedTool;
57+
58+
/**
59+
Start working.
60+
*/
61+
- (void)startWorking;
62+
63+
/**
64+
Stop working.
65+
*/
66+
- (void)stopWorking;
67+
68+
@property (nonatomic , assign , readonly) BOOL isWorking;
69+
70+
/**
71+
Automatic open debug view controller with index.
72+
*/
73+
- (void)showDebugViewControllerWithIndex:(NSInteger)index;
74+
75+
/**
76+
Print and save a log model with infos.
77+
78+
@param file File name.
79+
@param function Function name.
80+
@param lineNo Line number.
81+
@param level Log level.
82+
@param onEvent Event,can filter by this.
83+
@param message Message.
84+
*/
85+
- (void)logInFile:(NSString *)file function:(NSString *)function lineNo:(int)lineNo level:(LLConfigLogLevel)level onEvent:(NSString *)onEvent message:(NSString *)message, ... ;
86+
87+
@end

0 commit comments

Comments
 (0)