Registry / aws / amplify-cli-logger

amplify-cli-logger

JSON →
library1.2.3jsnpmunverified

Amplify CLI Logger v1.2.3 is a logging utility internal to the AWS Amplify CLI ecosystem. It provides structured logging for Amplify CLI commands and plugins, with support for multiple log levels and output formatting. Released as part of the AWS Amplify CLI monorepo, it is tightly coupled to the Amplify CLI runtime and is not intended for standalone use. The package ships TypeScript types and is distributed via npm under the @aws-amplify scope. It is currently in active development alongside the Amplify CLI, with releases aligned to the CLI's major version (currently v14.x). Key differentiators include integration with Amplify CLI's context object and automatic log level configuration based on CLI verbosity settings.

npm install amplify-cli-logger
INSTALL
IMPORT
SIG · AMPLIFY-CLI-LOGGER
A
amplify-cli-logger
awsjavascriptv1.2.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AmplifyLogger
import { AmplifyLogger } from '@aws-amplify/amplify-cli-logger'
import AmplifyLogger from '@aws-amplify/amplify-cli-logger'
This is a named export, not a default export. Using default import will result in undefined.
LogLevel
import { LogLevel } from '@aws-amplify/amplify-cli-logger'
import { LogLevels } from '@aws-amplify/amplify-cli-logger'
The enum is named LogLevel, not LogLevels. Available values: DEBUG, INFO, WARN, ERROR.
getAmplifyLogger
import { getAmplifyLogger } from '@aws-amplify/amplify-cli-logger'
const { getAmplifyLogger } = require('@aws-amplify/amplify-cli-logger')
This package is ESM-only. require() will fail unless you use a compatible Node version with esm resolution.

Shows creating a logger instance with configurable log level, logging messages at different levels including structured metadata, and proper cleanup.

import { AmplifyLogger, LogLevel } from '@aws-amplify/amplify-cli-logger'; const logger = new AmplifyLogger({ logLevel: process.env.VERBOSE ? LogLevel.DEBUG : LogLevel.INFO, outputStream: process.stdout }); logger.info('Amplify CLI initialized', { timestamp: new Date().toISOString() }); logger.debug('Verbose debugging info', { details: 'some context' }); try { // risky operation throw new Error('Operation failed'); } catch (err) { logger.error('An error occurred', { error: (err as Error).message }); } // Cleanup logger.close();
Debug
Known issues
breakingThe package is ESM-only starting from v1.2.0. require() will throw a MODULE_NOT_FOUND error.
fix
Use import statements or dynamic import(). If you must use CommonJS, use a dynamic import wrapper: const { AmplifyLogger } = await import('@aws-amplify/amplify-cli-logger');
affects: >=1.2.0
deprecatedConstructor parameter 'logLevel' was renamed from 'level' in v1.1.0.
fix
Replace { level: LogLevel.INFO } with { logLevel: LogLevel.INFO }.
affects: >=1.1.0
gotchaThe logger is not designed for direct instantiation outside Amplify CLI context. It expects an AmplifyContext object with specific properties.
fix
Use getAmplifyLogger() factory function instead which properly initializes the logger with the current CLI context.
affects: >=1.0.0
gotchaLogLevel enum values are strings ('DEBUG', 'INFO', 'WARN', 'ERROR'), not numbers. Comparing with === will work correctly but type narrowing may behave differently.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/@aws-amplify/amplify-cli-logger/dist/index.js from /path/to/project/index.js not supported.
The package is ESM-only and cannot be loaded with require().
fix
Change the import to use ESM syntax: import { AmplifyLogger } from '@aws-amplify/amplify-cli-logger'; Or use dynamic import: const { AmplifyLogger } = await import('@aws-amplify/amplify-cli-logger');
TypeError: Cannot read properties of undefined (reading 'info')
Default import results in undefined because the package only exports named exports.
fix
Use named import: import { AmplifyLogger } from '@aws-amplify/amplify-cli-logger'; instead of default import.
TS2339: Property 'LogLevels' does not exist on type 'typeof import("@aws-amplify/amplify-cli-logger")'.
Incorrect enum name: 'LogLevels' instead of 'LogLevel'.
fix
Use LogLevel instead: import { LogLevel } from '@aws-amplify/amplify-cli-logger';
Upgrade
Version history
1.2.3latest on npm
Audit
Dependencies
@aws-amplify/cli-corerequiredProvides core Amplify CLI types and context interfaces used by the logger
Agent activity
27 hits · last 30 days
node
24
Resources
amplify-cli-logger — npm install amplify-cli-logger · libregistry