The runtime language for Lambda provides a mechanism for your function to deliver logged statements to CloudWatch logs. We need any type of application to make the best use of its logs, not just serverless applications. With other applications, we can retrieve the logs from the server in which the application is deployed. However, with serverless applications that is not possible, as there is no server, and present, we don't have the ability to "step through" the code of a live, running lambda function. As a result, we are heavily dependent on the logs that we create to inform our investigation of our functions' behavior. Because of this, we have to make sure that any logs generated should have the right balance of verbosity to triage the issues without demanding too much computing time. It is recommended that we use an environment variable to create a loglevel variable.
The appropriate use of log levels can ensure that we have the ability to selectively incur the additional compute and storage cost only during an operational triage that our function can refer to so that it can determine which log statements to create during runtime.