@aws-lambda-powertools/logger
Version:
The logging package for the Powertools for AWS Lambda (TypeScript) library
78 lines • 3.3 kB
TypeScript
import { EnvironmentVariablesService as CommonEnvironmentVariablesService } from '@aws-lambda-powertools/commons';
import type { ConfigServiceInterface } from '../types/ConfigServiceInterface.js';
/**
* Class EnvironmentVariablesService
*
* This class is used to return environment variables that are available in the runtime of
* the current Lambda invocation.
* These variables can be a mix of runtime environment variables set by AWS and
* variables that can be set by the developer additionally.
*
* @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
* @see https://docs.powertools.aws.dev/lambda/typescript/latest/#environment-variables
*/
declare class EnvironmentVariablesService extends CommonEnvironmentVariablesService implements ConfigServiceInterface {
private awsLogLevelVariable;
private awsRegionVariable;
private currentEnvironmentVariable;
private functionNameVariable;
private functionVersionVariable;
private logEventVariable;
private logLevelVariable;
private logLevelVariableLegacy;
private memoryLimitInMBVariable;
private sampleRateValueVariable;
private tzVariable;
/**
* Return the value of the `AWS_LAMBDA_LOG_LEVEL` environment variable.
*
* The `AWS_LAMBDA_LOG_LEVEL` environment variable is set by AWS Lambda when configuring
* the function's log level using the Advanced Logging Controls feature. This value always
* takes precedence over other means of configuring the log level.
*
* We need to map the `FATAL` log level to `CRITICAL`, see {@link https://docs.aws.amazon.com/lambda/latest/dg/configuration-logging.html#configuration-logging-log-levels AWS Lambda Log Levels}.
*/
getAwsLogLevel(): string;
/**
* Return the value of the AWS_REGION environment variable.
*/
getAwsRegion(): string;
/**
* Return the value of the ENVIRONMENT environment variable.
*/
getCurrentEnvironment(): string;
/**
* Return the value of the AWS_LAMBDA_FUNCTION_MEMORY_SIZE environment variable.
*/
getFunctionMemory(): number;
/**
* Return the value of the AWS_LAMBDA_FUNCTION_NAME environment variable.
*/
getFunctionName(): string;
/**
* Return the value of the AWS_LAMBDA_FUNCTION_VERSION environment variable.
*/
getFunctionVersion(): string;
/**
* Return the value of the POWERTOOLS_LOGGER_LOG_EVENT environment variable.
*/
getLogEvent(): boolean;
/**
* Return the value of the `POWERTOOLS_LOG_LEVEL` or `LOG_LEVEL` (legacy) environment variables
* when the first one is not set.
*
* The `LOG_LEVEL` environment variable is considered legacy and will be removed in a future release.
* The `AWS_LAMBDA_LOG_LEVEL` environment variable always takes precedence over the ones above.
*/
getLogLevel(): string;
/**
* Return the value of the POWERTOOLS_LOGGER_SAMPLE_RATE environment variable.
*/
getSampleRateValue(): number | undefined;
/**
* Return the value of the `TZ` environment variable or `UTC` if it is not set.
*/
getTimezone(): string;
}
export { EnvironmentVariablesService };
//# sourceMappingURL=EnvironmentVariablesService.d.ts.map