Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent bc23e38efc
commit e1049fdfcc

@ -623,7 +623,7 @@ class MediaGalleryViewController: OWSNavigationController, MediaGalleryDataSourc
// Range instead of indexSet since it's contiguous?
var fetchedIndexSet = IndexSet() {
didSet {
Logger.debug("\(oldValue) -> \(fetchedIndexSet)")
Logger.debug("\(oldValue) -> \(self.fetchedIndexSet)")
}
}

@ -146,7 +146,7 @@ private class SignalCallData: NSObject {
didSet {
AssertIsOnMainThread()
Logger.debug(".peerConnectionClient setter: \(oldValue != nil) -> \(peerConnectionClient != nil) \(String(describing: peerConnectionClient))")
Logger.debug(".peerConnectionClient setter: \(oldValue != nil) -> \(self.peerConnectionClient != nil) \(String(describing: self.peerConnectionClient))")
}
}
@ -253,7 +253,7 @@ private class SignalCallData: NSObject {
}
}
Logger.debug(".callData setter: \(oldValue?.call.identifiersForLogs as Optional) -> \(callData?.call.identifiersForLogs as Optional)")
Logger.debug(".callData setter: \(oldValue?.call.identifiersForLogs as Optional) -> \(self.callData?.call.identifiersForLogs as Optional)")
for observer in observers {
observer.value?.didUpdateCall(call: callData?.call)

@ -121,7 +121,7 @@ protocol CallObserver: class {
var audioSource: AudioSource? = nil {
didSet {
AssertIsOnMainThread()
Logger.debug("audioSource changed: \(String(describing: oldValue)) -> \(String(describing: audioSource))")
Logger.debug("audioSource changed: \(String(describing: oldValue)) -> \(String(describing: self.audioSource))")
for observer in observers {
observer.value?.audioSourceDidChange(call: self, audioSource: audioSource)

@ -82,7 +82,7 @@ extension GiphyError: LocalizedError {
}
public func log() {
Logger.verbose("\t \(format), \(name), \(width), \(height), \(fileSize)")
Logger.verbose("\t \(self.format), \(self.name), \(self.width), \(self.height), \(self.fileSize)")
}
}
@ -114,7 +114,7 @@ extension GiphyError: LocalizedError {
}
public func log() {
Logger.verbose("giphyId: \(giphyId), \(renditions.count)")
Logger.verbose("giphyId: \(self.giphyId), \(self.renditions.count)")
for rendition in renditions {
rendition.log()
}

@ -28,13 +28,13 @@ public class DisappearingTimerConfigurationView: UIView {
override public var frame: CGRect {
didSet {
Logger.verbose("\(oldValue) -> \(frame)")
Logger.verbose("\(oldValue) -> \(self.frame)")
}
}
override public var bounds: CGRect {
didSet {
Logger.verbose("\(oldValue) -> \(bounds)")
Logger.verbose("\(oldValue) -> \(self.bounds)")
}
}

@ -160,7 +160,7 @@ public class SignalAttachment: NSObject {
AssertIsOnMainThread()
assert(oldValue == nil)
Logger.verbose("Attachment has error: \(String(describing: error))")
Logger.verbose("Attachment has error: \(String(describing: self.error))")
}
}

@ -142,7 +142,7 @@ public class OWSAudioSession: NSObject {
}
guard currentActivities.isEmpty else {
Logger.debug("not deactivating due to currentActivities: \(currentActivities)")
Logger.debug("not deactivating due to currentActivities: \(self.currentActivities)")
return
}

@ -4,16 +4,18 @@
NS_ASSUME_NONNULL_BEGIN
typedef NSString * (^OWSLogBlock)(void);
/**
* A minimal DDLog wrapper for swift.
*/
@interface OWSLogger : NSObject
+ (void)verbose:(NSString *)logString;
+ (void)debug:(NSString *)logString;
+ (void)info:(NSString *)logString;
+ (void)warn:(NSString *)logString;
+ (void)error:(NSString *)logString;
+ (void)verbose:(OWSLogBlock)logBlock;
+ (void)debug:(OWSLogBlock)logBlock;
+ (void)info:(OWSLogBlock)logBlock;
+ (void)warn:(OWSLogBlock)logBlock;
+ (void)error:(OWSLogBlock)logBlock;
+ (void)flush;
@end

@ -8,29 +8,29 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSLogger
+ (void)verbose:(NSString *)logString
+ (void)verbose:(OWSLogBlock)logBlock;
{
DDLogVerbose(@"%@", logString);
DDLogVerbose(@"%@", logBlock());
}
+ (void)debug:(NSString *)logString
+ (void)debug:(OWSLogBlock)logBlock;
{
DDLogDebug(@"%@", logString);
DDLogDebug(@"%@", logBlock());
}
+ (void)info:(NSString *)logString
+ (void)info:(OWSLogBlock)logBlock;
{
DDLogInfo(@"%@", logString);
DDLogInfo(@"%@", logBlock());
}
+ (void)warn:(NSString *)logString
+ (void)warn:(OWSLogBlock)logBlock;
{
DDLogWarn(@"%@", logString);
DDLogWarn(@"%@", logBlock());
}
+ (void)error:(NSString *)logString
+ (void)error:(OWSLogBlock)logBlock;
{
DDLogError(@"%@", logString);
DDLogError(@"%@", logBlock());
}
+ (void)flush

@ -21,23 +21,25 @@ public func owsFormatLogMessage(_ logString: String,
*/
open class Logger: NSObject {
open class func verbose(_ logString: @autoclosure () -> String,
open class func verbose(_ logString: @escaping @autoclosure () -> String,
file: String = #file,
function: String = #function,
line: Int = #line) {
#if DEBUG
let message = owsFormatLogMessage(logString(), file: file, function: function, line: line)
OWSLogger.verbose(message)
OWSLogger.verbose({
return owsFormatLogMessage(logString(), file: file, function: function, line: line)
})
#endif
}
open class func debug(_ logString: @autoclosure () -> String,
open class func debug(_ logString: @escaping @autoclosure () -> String,
file: String = #file,
function: String = #function,
line: Int = #line) {
#if DEBUG
let message = owsFormatLogMessage(logString(), file: file, function: function, line: line)
OWSLogger.debug(message)
OWSLogger.debug({
return owsFormatLogMessage(logString(), file: file, function: function, line: line)
})
#endif
}
@ -45,24 +47,27 @@ open class Logger: NSObject {
file: String = #file,
function: String = #function,
line: Int = #line) {
let message = owsFormatLogMessage(logString, file: file, function: function, line: line)
OWSLogger.info(message)
OWSLogger.info({
return owsFormatLogMessage(logString, file: file, function: function, line: line)
})
}
open class func warn(_ logString: String,
file: String = #file,
function: String = #function,
line: Int = #line) {
let message = owsFormatLogMessage(logString, file: file, function: function, line: line)
OWSLogger.warn(message)
OWSLogger.warn({
return owsFormatLogMessage(logString, file: file, function: function, line: line)
})
}
open class func error(_ logString: String,
file: String = #file,
function: String = #function,
line: Int = #line) {
let message = owsFormatLogMessage(logString, file: file, function: function, line: line)
OWSLogger.error(message)
OWSLogger.error({
return owsFormatLogMessage(logString, file: file, function: function, line: line)
})
}
open class func flush() {

Loading…
Cancel
Save