https://github.com/garrettmac/cloudwatch-console-logger
https://github.com/garrettmac/cloudwatch-console-logger
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/garrettmac/cloudwatch-console-logger
- Owner: garrettmac
- License: mit
- Created: 2018-05-02T02:20:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-15T22:16:06.000Z (about 7 years ago)
- Last Synced: 2024-10-14T09:31:02.523Z (8 months ago)
- Language: JavaScript
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudwatch Console Logger
[](https://travis-ci.org/garrettmac/cloudwatch-console-logger)
[](https://coveralls.io/github/garrettmac/cloudwatch-console-logger?branch=master)[](https://img.shields.io/github/stars/garrettmac/cloudwatch-console-logger.svg)
[](https://img.shields.io/github/license/garrettmac/cloudwatch-console-logger.svg)
[](https://img.shields.io/twitter/url/https/github.com/garrettmac/cloudwatch-console-logger.svg?style=social)## Getting started
This creates a global `logger` variable with the option to overide the `console` in an aws enviornment to print objects rather than strings.
This is useful when using loggly.com
```
yarn add cloudwatch-console-logger```
## Example Usage
```jsx
import CloudwatchConsoleLogger from 'cloudwatch-console-logger'
// initialize what you want to be added to each console.* or logger.* statment
CloudwatchConsoleLogger.init({
awsLambdaFunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
awsRegion: process.env.AWS_REGION,
timeZone: process.env.TZ
});logger.info('Hello world');
/*
prints on server side only
{
// initial data
awsLambdaFunctionName: "myLambdaFunction",
awsRegion: "some region",
timeZone: "some time zone",
// more data
message: "Hello world"
}
```