Merge branch 'mkirk/better-envelope-logging'

pull/1/head
Michael Kirk 8 years ago
commit a61e82653a

@ -133,7 +133,7 @@ CHECKOUT OPTIONS:
:commit: 23a5d1b67afc4dd028198202e25fd2e06ce396d7 :commit: 23a5d1b67afc4dd028198202e25fd2e06ce396d7
:git: https://github.com/WhisperSystems/SignalProtocolKit.git :git: https://github.com/WhisperSystems/SignalProtocolKit.git
SignalServiceKit: SignalServiceKit:
:commit: 1fd7627daf713521e5ea8f20e266873d41e8c488 :commit: 63cc0328b5523b53216285e0c754d0500b3ec344
:git: https://github.com/WhisperSystems/SignalServiceKit.git :git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket: SocketRocket:
:commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf :commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf

@ -1,5 +1,6 @@
// Created by Michael Kirk on 9/27/16. //
// Copyright © 2016 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSScrubbingLogFormatter.h" #import "OWSScrubbingLogFormatter.h"
@ -17,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *filteredString = [phoneRegex stringByReplacingMatchesInString:string NSString *filteredString = [phoneRegex stringByReplacingMatchesInString:string
options:0 options:0
range:NSMakeRange(0, [string length]) range:NSMakeRange(0, [string length])
withTemplate:@"[ REDACTED_PHONE_NUMBER ]"]; withTemplate:@"[ REDACTED_PHONE_NUMBER:xxx$1 ]"];
return filteredString; return filteredString;
} }

@ -1,5 +1,6 @@
// Created by Michael Kirk on 9/27/16. //
// Copyright © 2016 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSScrubbingLogFormatter.h" #import "OWSScrubbingLogFormatter.h"
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
@ -36,11 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
for (NSString *phoneString in phoneStrings) { for (NSString *phoneString in phoneStrings) {
OWSScrubbingLogFormatter *formatter = [OWSScrubbingLogFormatter new]; OWSScrubbingLogFormatter *formatter = [OWSScrubbingLogFormatter new];
NSString *actual = [formatter NSString *messageText = [NSString stringWithFormat:@"My phone number is %@", phoneString];
formatLogMessage:[self NSString *actual = [formatter formatLogMessage:[self messageWithString:messageText]];
messageWithString:[NSString stringWithFormat:@"My phone number is %@", phoneString]]]; NSRange redactedRange = [actual rangeOfString:@"My phone number is [ REDACTED_PHONE_NUMBER:xxx234 ]"];
NSRange redactedRange = [actual rangeOfString:@"My phone number is [ REDACTED_PHONE_NUMBER ]"];
XCTAssertNotEqual(NSNotFound, redactedRange.location, "Failed to redact phone string: %@", phoneString); XCTAssertNotEqual(NSNotFound, redactedRange.location, "Failed to redact phone string: %@", phoneString);
NSRange phoneNumberRange = [actual rangeOfString:phoneString]; NSRange phoneNumberRange = [actual rangeOfString:phoneString];

Loading…
Cancel
Save