![]() |
VOOZH | about |
dotnet add package AWS.Lambda.Powertools.Logging --version 3.2.2
NuGet\Install-Package AWS.Lambda.Powertools.Logging -Version 3.2.2
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="3.2.2" />
<PackageVersion Include="AWS.Lambda.Powertools.Logging" Version="3.2.2" />Directory.Packages.props
<PackageReference Include="AWS.Lambda.Powertools.Logging" />Project file
paket add AWS.Lambda.Powertools.Logging --version 3.2.2
#r "nuget: AWS.Lambda.Powertools.Logging, 3.2.2"
#:package AWS.Lambda.Powertools.Logging@3.2.2
#addin nuget:?package=AWS.Lambda.Powertools.Logging&version=3.2.2Install as a Cake Addin
#tool nuget:?package=AWS.Lambda.Powertools.Logging&version=3.2.2Install as a Cake Tool
The logging utility provides a AWS Lambda optimized logger with output structured as JSON.
For a full list of features go to docs.aws.amazon.com/powertools/dotnet/core/logging/
GitHub: https://github.com/aws-powertools/powertools-lambda-dotnet/
public class Function
{
[Logging(LogEvent = true)]
public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest apigwProxyEvent,
ILambdaContext context)
{
var requestContextRequestId = apigwProxyEvent.RequestContext.RequestId;
var lookupInfo = new Dictionary<string, object>()
{
{"LookupInfo", new Dictionary<string, object>{{ "LookupId", requestContextRequestId }}}
};
// Appended keys are added to all subsequent log entries in the current execution.
// Call this method as early as possible in the Lambda handler.
// Typically this is value would be passed into the function via the event.
// Set the ClearState = true to force the removal of keys across invocations,
Logger.AppendKeys(lookupInfo);
Logger.LogInformation("Getting ip address from external service");
var location = await GetCallingIp();
var lookupRecord = new LookupRecord(lookupId: requestContextRequestId,
greeting: "Hello Powertools for AWS Lambda (.NET)", ipAddress: location);
try
{
await SaveRecordInDynamo(lookupRecord);
return new APIGatewayProxyResponse
{
Body = JsonSerializer.Serialize(lookupRecord),
StatusCode = 200,
Headers = new Dictionary<string, string> { { "Content-Type", "application/json" } }
};
}
catch (Exception e)
{
Logger.LogError(e.Message);
return new APIGatewayProxyResponse
{
Body = e.Message,
StatusCode = 500,
Headers = new Dictionary<string, string> { { "Content-Type", "application/json" } }
};
}
}
}
{
"cold_start": false,
"xray_trace_id": "1-623d34cb-00c3698b02f11dc713442693",
"lookup": {
"lookup_id": "7d2ce9bb-c7d1-4304-9912-6078d276604f"
},
"function_name": "PowertoolsLoggingSample-HelloWorldFunction-hm1r10VT3lCy",
"function_version": "$LATEST",
"function_memory_size": 256,
"function_arn": "arn:aws:lambda:ap-southeast-2:111111111111:function:PowertoolsLoggingSample-HelloWorldFunction-hm1r10VT3lCy",
"function_request_id": "f5c3bae7-0e18-495a-9959-ef101c7afbc0",
"timestamp": "2022-03-25T03:19:39.9322301Z",
"level": "Information",
"service": "powertools-dotnet-logging-sample",
"name": "AWS.Lambda.Powertools.Logging.Logger",
"message": "Getting ip address from external service"
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on AWS.Lambda.Powertools.Logging:
| Package | Downloads |
|---|---|
|
Lambifast
Package Description |
Showing the top 2 popular GitHub repositories that depend on AWS.Lambda.Powertools.Logging:
| Repository | Stars |
|---|---|
|
aws/aws-lambda-dotnet
Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
|
|
| aws-samples/serverless-dotnet-demo |
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.2 | 9,673 | 5/25/2026 |
| 3.2.1 | 77,425 | 3/19/2026 |
| 3.2.0 | 22,466 | 3/12/2026 |
| 3.1.0 | 76,471 | 1/6/2026 |
| 3.0.2 | 122,784 | 11/5/2025 |
| 3.0.1 | 31,791 | 10/21/2025 |
| 3.0.1-alpha | 213 | 10/15/2025 |
| 3.0.0 | 5,274 | 10/8/2025 |
| 2.0.2 | 88,163 | 8/26/2025 |
| 2.0.1 | 27,510 | 7/29/2025 |
| 2.0.0 | 289,187 | 5/6/2025 |
| 2.0.0-preview.1 | 6,897 | 4/8/2025 |
| 1.7.0 | 95,072 | 4/8/2025 |
| 1.6.5 | 74,225 | 3/7/2025 |
| 1.6.4 | 98,566 | 1/28/2025 |
| 1.6.3 | 24,044 | 1/14/2025 |
| 1.6.2 | 368,325 | 10/22/2024 |
| 1.6.2-alpha2 | 3,491 | 10/9/2024 |
| 1.6.2-alpha | 199 | 10/9/2024 |
| 1.6.1 | 89,399 | 10/2/2024 |