Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Feb 21, 2024

Use AWS SDK for logging

For advanced use cases where Amplify does not provide the functionality, you can retrieve the escape hatch to access the underlying Amazon CloudWatch client.

Note: While the Amplify Library for Swift is production ready, please note that the underlying AWS SDK for Swift is currently in Developer Preview, and is not yet intended for production workloads. Here is additional reading material on the stability of the SDK

Add import statements

import AWSCloudWatchLoggingPlugin
import AWSCloudWatchLogs

Get a direct reference to the instance of CloudWatchLogsClientProtocol and directly interact with AWSCloudWatch via the AWS SDK for Swift

let cloudWatchPlugin = try Amplify.Logging.getPlugin(for: "awsCloudWatchLoggingPlugin") as? AWSCloudWatchLoggingPlugin
let cloudWatchClient: CloudWatchLogsClientProtocol? = cloudWatchPlugin?.getEscapeHatch()