-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed incorrect AWSCore dependency version in podspec (#191)
- Added logging helpers, added logging around mutation queue actions - AppSyncLog's `message` argument is now an autoclosure - Removed unused DispatchGroup from send operation - Removed unused context arg to send
- Loading branch information
Showing
18 changed files
with
196 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// Licensed under the Amazon Software License | ||
// http://aws.amazon.com/asl/ | ||
// | ||
|
||
import Foundation | ||
|
||
public final class AWSAppSyncClientLogFormatter: NSObject, AWSDDLogFormatter { | ||
|
||
static let dateFormatter: DateFormatter = { | ||
let dateFormatter = DateFormatter() | ||
// 2019-02-27 15:09:34.624-0800 | ||
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSZ" | ||
return dateFormatter | ||
}() | ||
|
||
public func format(message logMessage: AWSDDLogMessage) -> String? { | ||
let logLevelPrefix: String | ||
switch logMessage.flag { | ||
case .error: | ||
logLevelPrefix = "E" | ||
case .warning: | ||
logLevelPrefix = "W" | ||
case .info: | ||
logLevelPrefix = "I" | ||
case .debug: | ||
logLevelPrefix = "D" | ||
default: | ||
logLevelPrefix = "V" | ||
} | ||
|
||
let date = AWSAppSyncClientLogFormatter.dateFormatter.string(from: logMessage.timestamp) | ||
let file = AWSDDExtractFileNameWithoutExtension(logMessage.file, false) ?? "(no file)" | ||
let line = String(describing: logMessage.line) | ||
|
||
var sourceSection = file | ||
if let function = logMessage.function { | ||
sourceSection += ".\(function)" | ||
} | ||
sourceSection += ", L\(line)" | ||
|
||
let message = "\(date) [\(logLevelPrefix) \(sourceSection)] \(logMessage.message)" | ||
return message | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.