enum LogLevel · AWS CDK (original) (raw)

Language Type name
.NET Amazon.CDK.AWS.Lambda.Nodejs.LogLevel
Go github.com/aws/aws-cdk-go/awscdk/v2/awslambdanodejs#LogLevel
Java software.amazon.awscdk.services.lambda.nodejs.LogLevel
Python aws_cdk.aws_lambda_nodejs.LogLevel
TypeScript (source) aws-cdk-lib » aws_lambda_nodejs » LogLevel

Log levels for esbuild and package managers' install commands.

Example

new nodejs.NodejsFunction(this, 'my-handler', {
  bundling: {
    minify: true, // minify code, defaults to false
    sourceMap: true, // include source map, defaults to false
    sourceMapMode: nodejs.SourceMapMode.INLINE, // defaults to SourceMapMode.DEFAULT
    sourcesContent: false, // do not include original source into source map, defaults to true
    target: 'es2020', // target environment for the generated JavaScript code
    loader: { // Use the 'dataurl' loader for '.png' files
      '.png': 'dataurl',
    },
    define: { // Replace strings during build time
      'process.env.API_KEY': JSON.stringify('xxx-xxxx-xxx'),
      'process.env.PRODUCTION': JSON.stringify(true),
      'process.env.NUMBER': JSON.stringify(123),
    },
    logLevel: nodejs.LogLevel.ERROR, // defaults to LogLevel.WARNING
    keepNames: true, // defaults to false
    tsconfig: 'custom-tsconfig.json', // use custom-tsconfig.json instead of default,
    metafile: true, // include meta file, defaults to false
    banner: '/* comments */', // requires esbuild >= 0.9.0, defaults to none
    footer: '/* comments */', // requires esbuild >= 0.9.0, defaults to none
    charset: nodejs.Charset.UTF8, // do not escape non-ASCII characters, defaults to Charset.ASCII
    format: nodejs.OutputFormat.ESM, // ECMAScript module output format, defaults to OutputFormat.CJS (OutputFormat.ESM requires Node.js >= 14)
    mainFields: ['module', 'main'], // prefer ECMAScript versions of dependencies
    inject: ['./my-shim.js', './other-shim.js'], // allows to automatically replace a global variable with an import from another file
    esbuildArgs: { // Pass additional arguments to esbuild
      "--log-limit": "0",
      "--splitting": true,
    },
  },
});

Members

Name Description
VERBOSE Show everything.
DEBUG Show everything from info and some additional messages for debugging.
INFO Show warnings, errors, and an output file summary.
WARNING Show warnings and errors.
ERROR Show errors only.
SILENT Show nothing.

VERBOSE

Show everything.


DEBUG

Show everything from info and some additional messages for debugging.


INFO

Show warnings, errors, and an output file summary.


WARNING

Show warnings and errors.


ERROR

Show errors only.


SILENT

Show nothing.