namespace Amazon.Lambda.Core
{
#if NET6_0_OR_GREATER
///
/// Log Level for logging messages
///
public enum LogLevel
{
///
/// Trace level logging
///
Trace = 0,
///
/// Debug level logging
///
Debug = 1,
///
/// Information level logging
///
Information = 2,
///
/// Warning level logging
///
Warning = 3,
///
/// Error level logging
///
Error = 4,
///
/// Critical level logging
///
Critical = 5
}
#endif
///
/// Lambda runtime logger.
///
public interface ILambdaLogger
{
///
/// Logs a message to AWS CloudWatch Logs.
///
/// Logging will not be done:
/// If the role provided to the function does not have sufficient permissions.
///
///
void Log(string message);
///
/// Logs a message, followed by the current line terminator, to AWS CloudWatch Logs.
///
/// Logging will not be done:
/// If the role provided to the function does not have sufficient permissions.
///
///
void LogLine(string message);
#if NET6_0_OR_GREATER
///
/// Log message catagorized by the given log level
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
///
void Log(string level, string message) => LogLine(message);
///
/// Log message catagorized by the given log level
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
///
void Log(LogLevel level, string message) => Log(level.ToString(), message);
///
/// Log trace message
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
void LogTrace(string message) => Log(LogLevel.Trace.ToString(), message);
///
/// Log debug message
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
void LogDebug(string message) => Log(LogLevel.Debug.ToString(), message);
///
/// Log information message
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
void LogInformation(string message) => Log(LogLevel.Information.ToString(), message);
///
/// Log warning message
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
void LogWarning(string message) => Log(LogLevel.Warning.ToString(), message);
///
/// Log error message
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
void LogError(string message) => Log(LogLevel.Error.ToString(), message);
///
/// Log critical message
///
/// To configure the minimum log level set the AWS_LAMBDA_HANDLER_LOG_LEVEL environment variable. The value should be set
/// to one of the values in the LogLevel enumeration. The default minimum log level is "Information".
///
///
///
void LogCritical(string message) => Log(LogLevel.Critical.ToString(), message);
#endif
}
}