Redact 0.0.1

Redact 0.0.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2014年12月

Dan Brooker维护。



Redact 0.0.1

通过使用[obj redactedDescription]从日志中红字敏感字符串,类似于Rails的filter_parameters。

默认情况下,红字字典和基本键值样式日志中的密码属性。

红字字典

[@{@"password": "secret",@"username": @"user01"} redactedDescription]
-> {
     password: [REDACTED];
     username: "user01";
   }

红字字符串

[@"password = secret; username = user01" redactedDescription]
-> password = [REDACTED]; username = user01

使用说明

#import "Redact.h"

然后使用[obj redactedDescription];

或者使用RedactedLog()替代NSLog(),将以下宏之一添加到您的.pch文件中:

#define NSLog RedactedLogF // if you would like filename and function name
// or
#define NSLog RedactedLog // cleaner log and without any extra meta info

默认情况下password是一个红字键,但很容易添加更多。

[NCRedact addRedactedKey:@"secret_key"];

或使用redact来缩减日志

NSString *path = [[NSBundle mainBundle] bundlePath];
[NCRedact addRedactedString:path with:@"[BUNDLE]"];

测试

要运行测试用例;克隆存储库,并从Example目录运行pod install。然后打开工作空间并运行测试。

安装

作者

Daniel Brooker, [email protected], @DraconisNZ

许可证

Redact可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。