In the previous section we used some if-elif-else statements to add some input validation to our code. This checked that the SourceLanguageCode and TargetLanguageCode value were valid and printed a message.
Adding messages into our code that provide metadata information about how the code is executing is known as logging. Logs are useful in many ways. They can help pinpoint the flow of information in our code as well as where errors are being generated.
Normally we don’t want to display our log messages, we want to see the output of our program and only refer to log messages if we need them. In this section we are going to learn how to add logging into our code to separate out the information we want returned to the user and the log information we want saved into a log file. Initially we are going to generate this and save it locally on the Cloud9 instance.
Logs for code running in AWS, for example in a Lambda function are sent to to a service called CloudWatch. CloudWatch logs can be accessed via CloudWatch Logs, Log Groups. You can read more about CloudWatch in the documentation