Skip to content

Commit 79ab07b

Browse files
Merge branch 'dev'
2 parents 221d655 + 5448169 commit 79ab07b

File tree

10 files changed

+153
-63
lines changed

10 files changed

+153
-63
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## Release 2025-07-14 #2
2+
3+
### Amazon.Lambda.TestTool (0.11.1)
4+
* Fix issue causing sample requests to not be applied if a config path is not supplied
5+
### Amazon.Lambda.AspNetCoreServer (9.2.0)
6+
* Update Amazon.Lambda.Logging.AspNetCore dependency
7+
### Amazon.Lambda.AspNetCoreServer.Hosting (1.9.0)
8+
* Update Amazon.Lambda.Logging.AspNetCore dependency
9+
### Amazon.Lambda.Core (2.7.0)
10+
* Added log level with exception version of the static logging functions on Amazon.Lambda.Core.LambdaLogger
11+
### Amazon.Lambda.Logging.AspNetCore (4.1.0)
12+
* Convert logging parameters into JSON properties when Lambda log format is configured as JSON
13+
114
## Release 2025-06-25
215

316
### Amazon.Lambda.TestTool (0.11.0)

Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/Amazon.Lambda.AspNetCoreServer.Hosting.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
10-
<Version>1.8.2</Version>
10+
<Version>1.9.0</Version>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<AssemblyName>Amazon.Lambda.AspNetCoreServer.Hosting</AssemblyName>
1313
<PackageId>Amazon.Lambda.AspNetCoreServer.Hosting</PackageId>

Libraries/src/Amazon.Lambda.AspNetCoreServer/Amazon.Lambda.AspNetCoreServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Description>Amazon.Lambda.AspNetCoreServer makes it easy to run ASP.NET Core Web API applications as AWS Lambda functions.</Description>
77
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
88
<AssemblyTitle>Amazon.Lambda.AspNetCoreServer</AssemblyTitle>
9-
<Version>9.1.2</Version>
9+
<Version>9.2.0</Version>
1010
<AssemblyName>Amazon.Lambda.AspNetCoreServer</AssemblyName>
1111
<PackageId>Amazon.Lambda.AspNetCoreServer</PackageId>
1212
<PackageTags>AWS;Amazon;Lambda;aspnetcore</PackageTags>

Libraries/src/Amazon.Lambda.Core/Amazon.Lambda.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
77
<Description>Amazon Lambda .NET Core support - Core package.</Description>
88
<AssemblyTitle>Amazon.Lambda.Core</AssemblyTitle>
9-
<Version>2.6.0</Version>
9+
<Version>2.7.0</Version>
1010
<AssemblyName>Amazon.Lambda.Core</AssemblyName>
1111
<PackageId>Amazon.Lambda.Core</PackageId>
1212
<PackageTags>AWS;Amazon;Lambda</PackageTags>

Libraries/src/Amazon.Lambda.Core/LambdaLogger.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ private static void LogWithLevelAndExceptionToConsole(string level, Exception ex
7575
Console.WriteLine(exception);
7676
}
7777

78-
private const string ParameterizedPreviewMessage =
79-
"This method has been mark as preview till the Lambda .NET Managed runtime has been updated with the backing implementation of this method. " +
80-
"It is possible to use this method while in preview if the Lambda function is deployed as an executable and uses the latest version of Amazon.Lambda.RuntimeSupport.";
81-
8278
/// <summary>
8379
/// Logs a message to AWS CloudWatch Logs.
8480
///
@@ -114,7 +110,6 @@ public static void Log(string level, string message, params object[] args)
114110
/// <param name="exception">Exception to include with the logging.</param>
115111
/// <param name="message">Message to log. The message may have format arguments.</param>
116112
/// <param name="args">Arguments to format the message with.</param>
117-
[RequiresPreviewFeatures(ParameterizedPreviewMessage)]
118113
public static void Log(string level, Exception exception, string message, params object[] args)
119114
{
120115
_loggingWithLevelAndExceptionAction(level, exception, message, args);
@@ -130,7 +125,6 @@ public static void Log(string level, Exception exception, string message, params
130125
/// <param name="exception">Exception to include with the logging.</param>
131126
/// <param name="message">Message to log. The message may have format arguments.</param>
132127
/// <param name="args">Arguments to format the message with.</param>
133-
[RequiresPreviewFeatures(ParameterizedPreviewMessage)]
134128
public static void Log(LogLevel level, Exception exception, string message, params object[] args) => Log(level.ToString(), exception, message, args);
135129
#endif
136130
}

Libraries/src/Amazon.Lambda.Logging.AspNetCore/Amazon.Lambda.Logging.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Description>Amazon Lambda .NET Core support - Logging ASP.NET Core package.</Description>
77
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
88
<AssemblyTitle>Amazon.Lambda.Logging.AspNetCore</AssemblyTitle>
9-
<Version>4.0.0</Version>
9+
<Version>4.1.0</Version>
1010
<AssemblyName>Amazon.Lambda.Logging.AspNetCore</AssemblyName>
1111
<PackageId>Amazon.Lambda.Logging.AspNetCore</PackageId>
1212
<PackageTags>AWS;Amazon;Lambda;Logging</PackageTags>

Libraries/src/Amazon.Lambda.Logging.AspNetCore/LambdaILogger.cs

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,39 +52,61 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
5252
return;
5353
}
5454

55-
var components = new List<string>(4);
56-
if (_options.IncludeLogLevel)
57-
{
58-
components.Add($"[{logLevel}]");
59-
}
60-
61-
GetScopeInformation(components);
55+
var lambdaLogLevel = ConvertLogLevel(logLevel);
6256

63-
if (_options.IncludeCategory)
57+
if (IsLambdaJsonFormatEnabled && state is IEnumerable<KeyValuePair<string, object>> structure)
6458
{
65-
components.Add($"{_categoryName}:");
59+
string messageTemplate = null;
60+
var parameters = new List<object>();
61+
foreach (var property in structure)
62+
{
63+
if (property is { Key: "{OriginalFormat}", Value: string value })
64+
{
65+
messageTemplate = value;
66+
}
67+
else
68+
{
69+
parameters.Add(property.Value);
70+
}
71+
}
72+
73+
Amazon.Lambda.Core.LambdaLogger.Log(lambdaLogLevel, exception, messageTemplate, parameters.ToArray());
6674
}
67-
if (_options.IncludeEventId)
75+
else
6876
{
69-
components.Add($"[{eventId}]:");
70-
}
77+
var components = new List<string>(4);
78+
if (_options.IncludeLogLevel)
79+
{
80+
components.Add($"[{logLevel}]");
81+
}
7182

72-
var text = formatter.Invoke(state, exception);
73-
components.Add(text);
83+
GetScopeInformation(components);
7484

75-
if (_options.IncludeException)
76-
{
77-
components.Add($"{exception}");
78-
}
79-
if (_options.IncludeNewline)
80-
{
81-
components.Add(Environment.NewLine);
82-
}
85+
if (_options.IncludeCategory)
86+
{
87+
components.Add($"{_categoryName}:");
88+
}
89+
if (_options.IncludeEventId)
90+
{
91+
components.Add($"[{eventId}]:");
92+
}
8393

84-
var finalText = string.Join(" ", components);
94+
var text = formatter.Invoke(state, exception);
95+
components.Add(text);
8596

86-
var lambdaLogLevel = ConvertLogLevel(logLevel);
87-
Amazon.Lambda.Core.LambdaLogger.Log(lambdaLogLevel, finalText);
97+
if (_options.IncludeException)
98+
{
99+
components.Add($"{exception}");
100+
}
101+
if (_options.IncludeNewline)
102+
{
103+
components.Add(Environment.NewLine);
104+
}
105+
106+
var finalText = string.Join(" ", components);
107+
108+
Amazon.Lambda.Core.LambdaLogger.Log(lambdaLogLevel, finalText);
109+
}
88110
}
89111

90112
private static Amazon.Lambda.Core.LogLevel ConvertLogLevel(LogLevel logLevel)
@@ -126,9 +148,17 @@ private void GetScopeInformation(List<string> logMessageComponents)
126148
logMessageComponents.Add("=>");
127149
}
128150
}
129-
}
130-
131-
// Private classes
151+
}
152+
153+
private bool IsLambdaJsonFormatEnabled
154+
{
155+
get
156+
{
157+
return string.Equals(Environment.GetEnvironmentVariable("AWS_LAMBDA_LOG_FORMAT"), "JSON", StringComparison.InvariantCultureIgnoreCase);
158+
}
159+
}
160+
161+
// Private classes
132162
private class NoOpDisposable : IDisposable
133163
{
134164
public void Dispose()

0 commit comments

Comments
 (0)