Class ALambdaComponent
The ALambda
Inheritance
Implements
Namespace: LambdaSharp.App
Assembly: LambdaSharp.App.dll
Syntax
public abstract class ALambdaComponent : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ILambdaSharpLogger
Properties
AppClient
The App
Declaration
[Inject]
protected LambdaSharpAppClient AppClient { get; set; }
Property Value
Type | Description |
---|---|
Lambda |
The App |
DebugLoggingEnabled
The Debug
Declaration
public bool DebugLoggingEnabled { get; }
Property Value
Type | Description |
---|---|
System. |
Boolean indicating if requests and responses are logged |
Info
The Info property return information about the LambdaSharp environment.
Declaration
public ILambdaSharpInfo Info { get; }
Property Value
Type | Description |
---|---|
ILambda |
The ILambda |
Methods
Log(LambdaLogLevel, Exception, String, Object[])
Log a message wit the given severity level. The format
string is used to create a unique signature for errors.
Therefore, any error information that varies between occurrences should be provided in the arguments
parameter.
Declaration
public void Log(LambdaLogLevel level, Exception exception, string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
Lambda |
level | The severity level of the log message. See Lambda |
System. |
exception | Optional exception to log. The exception is logged with its description and stacktrace. This parameter can be |
System. |
format | Optional message to use instead of |
System. |
arguments | Optional arguments for the |
Remarks
Nothing is logged if both format
and exception
are null.
LogDebug(String, Object[])
Log a debugging message. This message will only appear in the log when debug logging is enabled and will not be forwarded to an error aggregator.
Declaration
protected void LogDebug(string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System. |
format | The message format string. If not arguments are supplied, the message format string will be printed as a plain string. |
System. |
arguments | Optional arguments for the message string. |
LogError(Exception)
Log an exception as an error. This message will be reported if an error aggregator is configured for the LambdaSharp.Core
module.
Declaration
protected void LogError(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System. |
exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
LogError(Exception, String, Object[])
Log an exception with a custom message as an error. This message will be reported if an error aggregator is configured for the LambdaSharp.Core
module.
Declaration
protected void LogError(Exception exception, string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System. |
exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System. |
format | Optional message to use instead of |
System. |
arguments | Optional arguments for the |
LogErrorAsInfo(Exception)
Log an exception as an information message. This message will only appear in the log and not be forwarded to an error aggregator.
Declaration
protected void LogErrorAsInfo(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System. |
exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
Remarks
Only use this method when the exception has no operational impact.
Otherwise, either use Log
LogErrorAsInfo(Exception, String, Object[])
Log an exception with a custom message as an information message. This message will only appear in the log and not be forwarded to an error aggregator.
Declaration
protected void LogErrorAsInfo(Exception exception, string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System. |
exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System. |
format | Optional message to use instead of |
System. |
arguments | Optional arguments for the |
Remarks
Only use this method when the exception has no operational impact.
Otherwise, either use Log
LogErrorAsWarning(Exception)
Log an exception as a warning. This message will be reported if an error aggregator is configured for the LambdaSharp.Core
module.
Declaration
protected void LogErrorAsWarning(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System. |
exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
Remarks
Only use this method when the exception has no operational impact.
Otherwise, either use Log
LogErrorAsWarning(Exception, String, Object[])
Log an exception with a custom message as a warning. This message will be reported if an error aggregator is configured for the LambdaSharp.Core
module.
Declaration
protected void LogErrorAsWarning(Exception exception, string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System. |
exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System. |
format | Optional message to use instead of |
System. |
arguments | Optional arguments for the |
Remarks
Only use this method when the exception has no operational impact.
Otherwise, either use Log
LogEvent<T>(T, IEnumerable<String>)
Send a CloudWatch event with optional event details and resources it applies to. This event is forwarded to the configured EventBridge. The 'detail-type' property is set to the full type name of the detail value.
Declaration
protected void LogEvent<T>(T detail, IEnumerable<string> resources = null)
Parameters
Type | Name | Description |
---|---|---|
T | detail | Data-structure to serialize as a JSON string. If value is already a , it is sent as-is. There is no other schema imposed. The data-structure may contain fields and nested subobjects.
|
System. |
resources | Optional AWS or custom resources, identified by unique identifier (e.g. ARN), which the event primarily concerns. Any number, including zero, may be present. |
Type Parameters
Name | Description |
---|---|
T |
LogEvent<T>(String, T, IEnumerable<String>)
Send a CloudWatch event with optional event details and resources it applies to. This event is forwarded to the configured EventBridge. The 'detail-type' property is set to the full type name of the detail value.
Declaration
protected void LogEvent<T>(string source, T detail, IEnumerable<string> resources = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
source | Name of the event source. |
T | detail | Data-structure to serialize as a JSON string. If value is already a , it is sent as-is. There is no other schema imposed. The data-structure may contain fields and nested subobjects.
|
System. |
resources | Optional AWS or custom resources, identified by unique identifier (e.g. ARN), which the event primarily concerns. Any number, including zero, may be present. |
Type Parameters
Name | Description |
---|---|
T |
LogEvent<T>(String, String, T, IEnumerable<String>)
Send a CloudWatch event with optional event details and resources it applies to. This event is forwarded to the configured EventBridge.
Declaration
protected void LogEvent<T>(string source, string detailType, T detail, IEnumerable<string> resources = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
source | Name of the event source. |
System. |
detailType | Free-form string used to decide what fields to expect in the event detail. |
T | detail | Data-structure to serialize as a JSON string. If value is already a , it is sent as-is. There is no other schema imposed. The data-structure may contain fields and nested subobjects.
|
System. |
resources | Optional AWS or custom resources, identified by unique identifier (e.g. ARN), which the event primarily concerns. Any number, including zero, may be present. |
Type Parameters
Name | Description |
---|---|
T |
LogFatal(Exception, String, Object[])
Log an exception with a custom message as a fatal error. This message will be reported if an error aggregator is configured for the LambdaSharp.Core
module.
Declaration
protected void LogFatal(Exception exception, string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System. |
exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System. |
format | Optional message to use instead of |
System. |
arguments | Optional arguments for the |
LogInfo(String, Object[])
Log an informational message. This message will only appear in the log and not be forwarded to an error aggregator.
Declaration
protected void LogInfo(string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System. |
format | The message format string. If not arguments are supplied, the message format string will be printed as a plain string. |
System. |
arguments | Optional arguments for the message string. |
LogMetric(IEnumerable<LambdaMetric>)
Log a CloudWatch metric. The metric is picked up by CloudWatch logs and automatically ingested as a CloudWatch metric.
Declaration
protected void LogMetric(IEnumerable<LambdaMetric> metrics)
Parameters
Type | Name | Description |
---|---|---|
System. |
metrics | Enumeration of metrics, including their name, value, and unit. |
LogMetric(IEnumerable<LambdaMetric>, IEnumerable<String>, Dictionary<String, String>)
Log a CloudWatch metric. The metric is picked up by CloudWatch logs and automatically ingested as a CloudWatch metric.
Declaration
protected virtual void LogMetric(IEnumerable<LambdaMetric> metrics, IEnumerable<string> dimensionNames, Dictionary<string, string> dimensionValues)
Parameters
Type | Name | Description |
---|---|---|
System. |
metrics | Enumeration of metrics, including their name, value, and unit. |
System. |
dimensionNames | Metric dimensions as comma-separated list (e.g. [ "A", "A,B" ]). |
System. |
dimensionValues | Dictionary of dimesion name-value pairs. |
LogMetric(String, Double, LambdaMetricUnit)
Log a CloudWatch metric. The metric is picked up by CloudWatch logs and automatically ingested as a CloudWatch metric.
Declaration
protected void LogMetric(string name, double value, LambdaMetricUnit unit)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Metric name. |
System. |
value | Metric value. |
Lambda |
unit | Metric unit. |
LogMetric(String, Double, LambdaMetricUnit, IEnumerable<String>, Dictionary<String, String>)
Log a CloudWatch metric. The metric is picked up by CloudWatch logs and automatically ingested as a CloudWatch metric.
Declaration
protected void LogMetric(string name, double value, LambdaMetricUnit unit, IEnumerable<string> dimensionNames, Dictionary<string, string> dimensionValues)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Metric name. |
System. |
value | Metric value. |
Lambda |
unit | Metric unit. |
System. |
dimensionNames | Metric dimensions as comma-separated list (e.g. [ "A", "A,B" ]). |
System. |
dimensionValues | Dictionary of dimesion name-value pairs. |
LogRecord(ALambdaLogRecord)
Log a ALambda
Declaration
public void LogRecord(ALambdaLogRecord record)
Parameters
Type | Name | Description |
---|---|---|
ALambda |
record | The record to log. |
LogWarn(String, Object[])
Log a warning message. This message will be reported if an error aggregator is configured for the LambdaSharp.Core
module.
Declaration
protected void LogWarn(string format, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System. |
format | The message format string. If not arguments are supplied, the message format string will be printed as a plain string. |
System. |
arguments | Optional arguments for the message string. |