Package Exports
- serverless-configure-lambda-logs
- serverless-configure-lambda-logs/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-configure-lambda-logs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Serverless Configure Lambda Logs
A Serverless Framework plugin (compatible with version 3.40.0 and earlier) to configure AWS Lambda logging options.
Installation
# NPM
npm install --save-dev serverless-configure-lambda-logs
# Or using the Serverless Framework plugin command
serverless plugin install -n serverless-configure-lambda-logs
Local Development
If you want to develop or test this plugin locally:
- Clone this repository
- Install it locally in your project:
# In your Serverless project directory
npm install --save-dev /path/to/serverless-configure-lambda-logs
Usage
Add the plugin to your serverless.yml
file:
plugins:
- serverless-configure-lambda-logs
Global Configuration
Configure log options globally for all functions:
custom:
logs:
format: json # 'json' or 'text' (default is 'text')
applicationLevel: INFO # 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL' (default is 'ERROR')
systemLevel: INFO # 'DEBUG', 'INFO', 'WARN' (default is 'WARN')
logGroup: /custom/log/group/path # Optional: specify a custom log group
Per-Function Configuration
Configure log options individually for each function:
functions:
hello:
handler: handler.hello
logs:
format: json
applicationLevel: DEBUG
systemLevel: DEBUG
logGroup: /custom/log/group/path
Features
- Log configuration options with automatic CloudFormation injection
- Support for text and JSON log formats
- Configurable log levels
- Updates configurations via AWS SDK
- Support for custom log groups
- NEW in 1.0.7: Compatibility with serverless-plugin-split-stacks
Log Levels
Application Log Levels
- TRACE: Most detailed information for debugging
- DEBUG: Detailed information for debugging
- INFO: Informational messages
- WARN: Potentially problematic situations
- ERROR: Errors that allow the application to continue
- FATAL: Severe errors that prevent the application from functioning
System Log Levels
- DEBUG: Detailed information about the Lambda system
- INFO: General information about the Lambda system
- WARN: Warnings about the Lambda system
License
This project is licensed under the MIT License - see the LICENSE file for details.