@nesn/commons-lambda-logger
TypeScript icon, indicating that this package has built-in type declarations

1.0.20 • Public • Published

NESN LAMBDA LOGGER

A compact logger that works in both commonJS and ES module projects.

Usage

// CommonJS
const { lambdaLogger } = require('@nesn/lambda-logger');

// ES Modules
import { lambdaLogger } from '@nesn/lambda-logger';

lambdaLogger.info|error|warn(message:string, meta:Record<string, any>, ...tags | null);

Example

// CommonJS
const { lambdaLogger } = require('@nesn/lambda-logger');

// ES Modules
import { lambdaLogger} from '@nesn/lambda-logger';

lambdaLogger.info | error | warn('Your log message here', {
    metadata: 'goes here',
    nested: {
        objects: {
            description: 'are okay as well'
        },
        example: {
            user: {
                email: 'me@here.com',
                name: 'Some Juan'
            }
        }
    } // Use any number of LogTags
}, 'tag_1', 'tag_two', 'tag_3');
Field	Value
@ingestionTime	1690917057370
@log	837502413404:/aws/lambda/<your-lambda-and-log-group>
@logStream	2023/08/01/[$LATEST]11221d14ce6c4c5ea715d4255fec83e0
@message	2023-08-01T19:10:52.522Z	2d82aa0d-915e-4d27-b21c-efc055cdef03	INFO	THIS IS A MESSAGE FROM STANDARD WINSTON LOGGER {"email":"me@here.com","nested":{"foo":{"id":"0u812"}},"tags":"get_user_tag,entitlement_tag,ip_lookup_tag"}
@requestId	2d82aa0d-915e-4d27-b21c-efc055cdef03
@timestamp	1690917052522
nested.objects.description are okay as well
nested.example.user.email	me@here.com
nested.example.user.name	Some Juan
tags	tag_1,tag_two,

Readme

Keywords

Package Sidebar

Install

npm i @nesn/commons-lambda-logger

Weekly Downloads

1

Version

1.0.20

License

MIT

Unpacked Size

15.3 kB

Total Files

10

Last publish

Collaborators

  • nesn-admin