Class LambdaErrorReportGenerator
The LambdaErrorReportGenerator class is used to create LambdaErrorReport instances. Each Lambda function is initialized with an instance of LambdaErrorReportGenerator class using its configuration and runtime settings.
Inheritance
Implements
Namespace: LambdaSharp.Logging.ErrorReports
Assembly: LambdaSharp.Logging.dll
Syntax
public class LambdaErrorReportGenerator : ILambdaErrorReportGenerator
Constructors
LambdaErrorReportGenerator(String, String, String, String, String, String, String, String, String, String)
Creates a new LambdaErrorReportGenerator instance with the specified configuration settings.
Declaration
public LambdaErrorReportGenerator(string moduleId, string moduleInfo, string platform, string functionId, string functionName, string appId, string appName, string framework, string gitSha, string gitBranch)
Parameters
Type | Name | Description |
---|---|---|
System.String | moduleId | The stack name of the deployed LambdaSharp module. |
System.String | moduleInfo | The LambdaSharp module name and version. |
System.String | platform | The platform running the code. |
System.String | functionId | The ID of the deployed Lambda function. |
System.String | functionName | The Lambda function name. |
System.String | appId | The ID of the deployed app. |
System.String | appName | The app name. |
System.String | framework | The Lambda execution framework. |
System.String | gitSha | An optional git SHA. |
System.String | gitBranch | An optional git branch name. |
Methods
CreateReport(String, String, Exception, String, Object[])
The CreateReport(String, String, Exception, String, Object[]) method create a new LambdaErrorReport instance from the provided parameters.
Declaration
public LambdaErrorReport CreateReport(string requestId, string level, Exception exception, string format = null, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.String | requestId | The AWS request ID. |
System.String | level | The severity level of the error report. |
System.Exception | exception | An optional exception instance. |
System.String | format | An optional message. |
System.Object[] | args | Optional arguments for the error message. |
Returns
Type | Description |
---|---|
LambdaErrorReport | A new LambdaErrorReport instance. |
Remarks
See args
parameter
impacts the processing of the format
parameter.
FormatMessage(String, Object[])
The FormatMessage(String, Object[]) method behaves identically to the System.String.Format(System.String,System.Object[]) method
when the format
parameter is not null
and the args
parameter is non-empty.
If the format
parameter is null
, this method returns null
. If the args
parameter is empty,
this method return the value of the format
parameter.
Declaration
public static string FormatMessage(string format, object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | An optional message. |
System.Object[] | args | Optional arguments for the error message. |
Returns
Type | Description |
---|---|
System.String | The formatted string. |