当前位置: 首页 > news >正文

网站开发的业务风险google服务框架

网站开发的业务风险,google服务框架,易语言怎么做无限打开网站,在百度上做购物网站1.背景 为在线教育部提供高效、安全、易用的日志组件。 2.功能介绍 2.1 日志格式化 目前输出的日志格式如下: 日志级别/[YYYY-MM-DD HH:MM:SS MS] TinyLog-Tag: |线程| 代码文件名:行数|函数名|日志输出内容触发flush到文件的时机: 每15分钟定时触发…

1.背景

为在线教育部提供高效、安全、易用的日志组件。

2.功能介绍

2.1 日志格式化

目前输出的日志格式如下:

日志级别/[YYYY-MM-DD HH:MM:SS MS] TinyLog-Tag: |线程| 代码文件名:行数|函数名|日志输出内容
  • 触发flush到文件的时机:

    1. 每15分钟定时触发;
    2. mmap buffer满时触发。
  • 日志清理时机:
    组件init时,会自动清理过期日志,目前默认保留7天日志。

2.2 支持压缩加密

日志组件可通过接口设置是否压缩以及加密。

  • 压缩模式为:zlib默认压缩模式;
  • 加密模式为:RSA+AES流式加密。
2.3 支持日志上传和打包

调用日志上传和打包接口时,日志组件会根据传入参数时间将所需文件按照统一格式进行压缩打包。

2.4 支持FancyLog

在相应场景调用FancyLog接口,日志上传到后台后,可查看根据调用顺序绘制出来的流程图。

2.5 支持日志脱敏

可支持以下数据的脱敏:

  • 大陆手机号
  • 18位身份证号
  • 邮箱号
  • 自定义替换关键词:正则表达式、$(###)和${###}

$(###) 和${###} 区别是,前者为非贪婪匹配,后者为贪婪匹配,示例如下:

SensitiveConvertor *convertor = [[SensitiveConvertor alloc] initReplacerWithPattern:@"我不是$(###),"];
NSString *convertString = [convertor replace:@"我不是潘金莲,我是李雪莲,"];
//output: 我不是******,我是李雪莲,
SensitiveConvertor *convertor = [[SensitiveConvertor alloc] initReplacerWithPattern:@"我不是${###},"];
NSString *convertString = [convertor replace:@"我不是潘金莲,我是李雪莲,接下来"];
//output: 我不是******,接下来

3.使用说明

3.1 日志接口

组件内已经预定义好了一些宏,可以直接使用:

  • 接口列表
#pragma mark -- TinyLog
#define TinyLogVerbose(TAG, fmt, ...)
#define TinyLogInfo(TAG, fmt, ...)
#define TinyLogDebug(TAG, fmt, ...)
#define TinyLogWarning(TAG, fmt, ...)
#define TinyLogError(TAG, fmt, ...)#pragma mark -- TLog
#define TLogVerbose(fmt, ...)
#define TLogInfo(fmt, ...)
#define TLogDebug(fmt, ...)
#define TLogWarning(fmt, ...)
#define TLogError(fmt, ...)
  • 使用示例:
TinyLogInfo(@"ABCmouse", @"This is a test msg (%@) With A TAG.", @"test111");
TLogInfo(@"This is a test msg (%@) without A TAG.", @"test222");
3.2 参数设置接口
  • 接口列表
#pragma mark 参数设置接口
// 是否打开控制台,类型为bool。默认关闭
- (void)enableLogConsole:(BOOL)enable;
// 是否压缩,类型为bool。默认压缩
- (void)enableLogCompress:(BOOL)enable;
// 是否加密,类型为bool。默认加密
- (void)enableLogEncrypt:(BOOL)enable;
// 单个日志文件大小限制,类型为int。单位为MB。默认为-1,不限制
- (void)setLogSingleSizeLimit:(int)logSingleSizeLimit;
// 设置日志级别
- (void)setLogLevel:(TLogPriority)logPriority;
  • 使用示例:
[[TinyLog shareInstance] enableLogConsole:YES];
// 其他接口调用方式类似,根据接口说明传入参数调用即可。
3.3 初始化接口
#pragma mark 初始化接口
// TinyLog初始化接口
- (void)setAppkey:(NSString *)appkey;
// 设置用户ID
- (void)setIdentifyID:(NSString *)identifyID;
// !!!必须设置,不然无法上传日志
- (void)setTinyChannel:(id<ITinyChannel>)tinyChannel;
3.4 日志上传及打包接口
#pragma mark 日志上传接口
//上报区间内的
- (void)uploadFileBegin:(long long)beginTime end:(long long)endTime;
// 上报 指定某一天的
- (void)uploadFileDate:(NSDate *)date;
// 上报 前 hours 小时的
- (void)uploadFileHous:(NSInteger)hours;#pragma mark 日志打包接口
//上报区间内的
- (NSString *)getFileBegin:(long long)beginTime end:(long long)endTime;
// 上报 指定某一天的
- (NSString *)getFileDate:(NSDate *)date;
// 上报 前 hours 小时的
- (NSString *)getFileHous:(NSInteger)hours;
3.5 记录crash日志接口
#pragma mark 记录crash日志接口
- (void)setCrashLogWithID:(int)crashID crashContent:(NSString *)crashContent;
3.6 tinylog内部错误打印接口
#pragma mark tinylog内部错误打印接口
+ (void)setLogExceptionReporter:(id <LogExceptionReporterDelegate>)exceptionReporter;
+ (id <LogExceptionReporterDelegate>)getLogger;

调用示例:

@interface YourClass ()<LogExceptionReporterDelegate>
// ...
@end@implementation YourClass- (void)YourMethod {
// ...[TinyLog setLogExceptionReporter:self];
// ...
}- (void)exceptionReporter:(int)errCode ErrMsg:(NSString *)errMsg {NSLog(@"%d(%@)", errCode, errMsg);// TODO
}- (void)onCrashNotify:(int)crashID {NSLog(@"onCrashNotify(%d)", crashID);
}
3.6 FancyLog接口
  • 接口列表
/*场景相关*/
+ (void)loadScene:(NSString *)sceneName;
+ (void)loadSceneSuccess:(NSString *)sceneName;
+ (void)loadSceneFailed:(NSString *)sceneName;/*操作相关*/
+ (void)swithBack:(NSString *)msg;
+ (void)switchFront:(NSString *)msg;
+ (void)click:(NSString *)msg;/*出现异常*/
+ (void)exception:(NSException *)exception Msg:(NSString *)msg;
+ (void)crash:(NSException *)exception Msg:(NSString *)msg;/*过程*/
+ (void)processStart:(NSString *)msg;
+ (void)processing:(NSString *)msg;
+ (void)processEnd:(NSString *)msg;/*自定义事件*/
+ (void)event:(NSString *)event;
  • 调用示例
// ...
// 根据实际场景调用接口
[FancyLog loadScene:@"This is A Test Secene"];
// ...
3.7 日志脱敏接口
  • 接口列表
#pragma mark -- 转换接口
/// 日志脱敏配置接口1
/// @param converPhone 是否需要对手机号进行脱敏,YES:需要,NO:不需要
/// @param convertIDCard 是否需要对身份证号进行脱敏,YES:需要,NO:不需要
/// @param convertEmail 是否需要对邮箱号进行脱敏,YES:需要,NO:不需要
/// @param customPattern 自定义关键字,支持正则、$(###)、${###}
- (id)initWithConvertPhone:(BOOL)converPhone ConvertIDCard:(BOOL)convertIDCard ConvertEmail:(BOOL)convertEmail CustomPattern:(NSString *)customPattern;/// 转换接口
/// @param originString 待脱敏的字符串
/// @return 脱敏后的字符串
- (NSString *)convert:(NSString *)originString;#pragma mark -- 替换接口
/// 日志脱敏配置接口2
/// @param pattern 自定义关键字,支持正则、$(###)、${###}
- (id)initReplacerWithPattern:(NSString *)pattern;/// 替换接口
/// @param originString 待脱敏的字符串
/// @return 脱敏后的字符串
- (NSString *)replace:(NSString *)originString;
  • 调用示例
SensitiveConvertor *convertor1 = [[SensitiveConvertor alloc] initWithConvertPhone:YES ConvertIDCard:YES ConvertEmail:YES CustomPattern:@"我不是${###},"];NSString *convertString1 = [convertor1 convert:@"我的手机号是18011112222,身份证号是110101199001011234,邮箱号是tinylog@qq.com,我不是潘金莲,我是李雪莲,接下来"];SensitiveConvertor *convertor2 = [[SensitiveConvertor alloc] initReplacerWithPattern:@"我不是$(###),"];
NSString *convertString2 = [convertor2 replace:@"我不是潘金莲,我是李雪莲,"];

4.其他

4.1 日志文件解密

  • 在线解密
    调用上传接口后,日志会上传到http://tiny.edu.woa.com/log

    • 点击下载按钮,可下载解密解压后的日志文件
    • 点击在线查看按钮,可在线查看解密解压后的日志内容
      在这里插入图片描述
  • 本地解密
    调用打包接口后,根据返回的文件路径,使用本地解密工具解密,具体使用方法可参考Tinylog本地解密工具

4.2 Crash场景处理

如果希望能将Crash堆栈也写进日志文件里,可在崩溃监听回调函数中调用TinyLog的写日志接口,以RQD的崩溃监听回调函数为例:

int app_crash_handler_callback() {// ...// 获取sdk生成的crash.logNSString *crashLog = [[CrashReporter sharedInstance] getCrashLog];TLogError(@"crash log:%@", crashLog);// 或者调用 [[TinyLog shareInstance] setCrashLogWithID:_crashID crashContent:crashLog];return 0;
}// ...
[[CrashReporter sharedInstance] setUserCrashHandlerCallback:app_crash_handler_callback];
http://www.fp688.cn/news/162211.html

相关文章:

  • 做网站的销售怎么样广点通广告投放平台登录
  • 兰州网站制作cheng站长之家app
  • 网站编辑 seo是什么 百度知道百度产品大全入口
  • wordpress免费企业主题网站营销活动推广策划
  • 刚做的网站搜索不到aso优化吧
  • 网站政府网站集约化建设盐城seo营销
  • 网站打不开怎么办东莞关键词优化软件
  • 自己做的网站如何制作后台淘宝流量平台
  • isp网站接入做哪些业务保定关键词排名推广
  • 网站制作地点软文推广文章案例
  • 网站谁做的比较好发外链平台
  • 注册网站商标多少钱最近几天新闻大事
  • html网站建设app推广接单渠道
  • 网站的营销特点成人短期培训能学什么
  • 做网站的公司北京有哪些关键词英文
  • 微信做模板下载网站有哪些内容电商培训机构有哪些?哪家比较好
  • 宣城 网站建设快速提高关键词排名的软件
  • 做网站维护要学些什么全面落实疫情防控优化措施
  • app开发的网站最新的全国疫情
  • 开网站做销售提高工作效率英语
  • 新网做网站流程怎么做好网站方式推广
  • 潍坊网站建设熊掌号网络舆情管理
  • 身份证和手机做验证码注册网站免费crm
  • 宁波网站建设用什么软件网站推广seo设置
  • 广州公司注册名称核名查询系统网页版优化排名
  • 网站二维码怎么做百度收录入口
  • 检察机关门户网站建设自查报告建网站公司
  • 有赞小程序开发平台北京网站seo优化推广
  • 电子商务网站建设与管理课后题答案新手如何学seo
  • 上海企业网站建设服务网站优化有哪些类型