Class ALambdaComponent
The ALambdaComponent class is used for creating Blazor components with direct access to all the ILambdaSharpLogger methods.
Inheritance
Implements
Namespace: LambdaSharp.App
Assembly: LambdaSharp.App.dll
Syntax
public abstract class ALambdaComponent : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ILambdaSharpLogger
Properties
AppClient
The AppClient property return the client for communicating with the LambdaSharp App API.
Declaration
[Inject]
protected LambdaSharpAppClient AppClient { get; set; }
Property Value
Type | Description |
---|---|
LambdaSharpAppClient | The AppClient instance. |
DebugLoggingEnabled
The DebugLoggingEnabled property indicates if log statements using DEBUG are emitted.
Declaration
public bool DebugLoggingEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean | 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 |
---|---|
ILambdaSharpInfo | The ILambdaSharpInfo instance. |
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 |
---|---|---|
LambdaLogLevel | level | The severity level of the log message. See LambdaLogLevel for a description of the severity levels. |
System.Exception | exception | Optional exception to log. The exception is logged with its description and stacktrace. This parameter can be |
System.String | format | Optional message to use instead of |
System.Object[] | 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.String | format | The message format string. If not arguments are supplied, the message format string will be printed as a plain string. |
System.Object[] | 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 | 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 | exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System.String | format | Optional message to use instead of |
System.Object[] | 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 | 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 LogError(Exception) or LogErrorAsWarning(Exception).
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 | exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System.String | format | Optional message to use instead of |
System.Object[] | arguments | Optional arguments for the |
Remarks
Only use this method when the exception has no operational impact. Otherwise, either use LogError(Exception) or LogErrorAsWarning(Exception).
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 | 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 LogError(Exception).
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 | exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System.String | format | Optional message to use instead of |
System.Object[] | arguments | Optional arguments for the |
Remarks
Only use this method when the exception has no operational impact. Otherwise, either use LogError(Exception).
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.Collections.Generic.IEnumerable<System.String> | 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.String | 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.Collections.Generic.IEnumerable<System.String> | 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.String | source | Name of the event source. |
System.String | 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.Collections.Generic.IEnumerable<System.String> | 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 | exception | The exception to log. The exception is logged with its message, stacktrace, and any nested exceptions. |
System.String | format | Optional message to use instead of |
System.Object[] | 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.String | format | The message format string. If not arguments are supplied, the message format string will be printed as a plain string. |
System.Object[] | 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.Collections.Generic.IEnumerable<LambdaMetric> | 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.Collections.Generic.IEnumerable<LambdaMetric> | metrics | Enumeration of metrics, including their name, value, and unit. |
System.Collections.Generic.IEnumerable<System.String> | dimensionNames | Metric dimensions as comma-separated list (e.g. [ "A", "A,B" ]). |
System.Collections.Generic.Dictionary<System.String, System.String> | 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.String | name | Metric name. |
System.Double | value | Metric value. |
LambdaMetricUnit | 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.String | name | Metric name. |
System.Double | value | Metric value. |
LambdaMetricUnit | unit | Metric unit. |
System.Collections.Generic.IEnumerable<System.String> | dimensionNames | Metric dimensions as comma-separated list (e.g. [ "A", "A,B" ]). |
System.Collections.Generic.Dictionary<System.String, System.String> | dimensionValues | Dictionary of dimesion name-value pairs. |
LogRecord(ALambdaLogRecord)
Log a ALambdaLogRecord record instance.
Declaration
public void LogRecord(ALambdaLogRecord record)
Parameters
Type | Name | Description |
---|---|---|
ALambdaLogRecord | 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.String | format | The message format string. If not arguments are supplied, the message format string will be printed as a plain string. |
System.Object[] | arguments | Optional arguments for the message string. |