Code Monkey home page Code Monkey logo

Comments (3)

tripodsan avatar tripodsan commented on August 19, 2024

How it's setup:

Lambda Code

here' the code of the function:

exports.handler = async (event) => {
    console.log('hello log', { a:42, b:'hello, world'});
    console.debug('hello debug', { a:42, b:'hello, world'});
    console.info('hello info', { a:42, b:'hello, world'});
    console.warn('hello warn', { a:42, b:'hello, world'});
    console.error('hello error', { a:42, b:'hello, world'});
    
    console._stderr.write('[DEBUG] test log debug\n');
    console._stderr.write('[INFO] test log info\n');
    console._stderr.write('[WARN] test log warn\n');
    console._stderr.write('[ERROR] test log error\n');
    
    console._stderr.write('*DEBUG* test log debug\n');
    console._stderr.write('*INFO* test log info\n');
    console._stderr.write('*WARN* test log warn\n');
    console._stderr.write('*ERROR* test log error\n');
    
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    };
    return response;
};

CloudWatch logs

here's the output on cloud watch:

START RequestId: 0dd4f1d3-6aad-4e4c-8369-e395c834eefc Version: $LATEST
--
2021/02/23 02:19:46 Initializing Lambda Extension coralogix-extension
2021/02/23 02:19:46 Registering to Extensions API
2021/02/23 02:19:46 Initializing HTTP Server on 0.0.0.0:4342
2021/02/23 02:19:46 Serving HTTP Server on 0.0.0.0:4342
2021/02/23 02:19:46 Subscribing to Logs API
LOGS	Name: coralogix-extension	State: Subscribed	Types: [platform,function]
2021/02/23 02:19:46 Successfully subscribed to Logs API: "OK"
EXTENSION	Name: coralogix-extension	State: Ready	Events: [INVOKE,SHUTDOWN]
2021-02-23T02:19:46.615Z	0dd4f1d3-6aad-4e4c-8369-e395c834eefc	INFO	hello log { a: 42, b: 'hello, world' }
2021-02-23T02:19:46.635Z	0dd4f1d3-6aad-4e4c-8369-e395c834eefc	DEBUG	hello debug { a: 42, b: 'hello, world' }
2021-02-23T02:19:46.655Z	0dd4f1d3-6aad-4e4c-8369-e395c834eefc	INFO	hello info { a: 42, b: 'hello, world' }
2021-02-23T02:19:46.655Z	0dd4f1d3-6aad-4e4c-8369-e395c834eefc	WARN	hello warn { a: 42, b: 'hello, world' }
2021-02-23T02:19:46.655Z	0dd4f1d3-6aad-4e4c-8369-e395c834eefc	ERROR	hello error { a: 42, b: 'hello, world' }
[DEBUG] test log debug
[INFO] test log info
[WARN] test log warn
[ERROR] test log error
*DEBUG* test log debug
*INFO* test log info
*WARN* test log warn
*ERROR* test log error
END RequestId: 0dd4f1d3-6aad-4e4c-8369-e395c834eefc
REPORT RequestId: 0dd4f1d3-6aad-4e4c-8369-e395c834eefc	Duration: 1887.56 ms	Billed Duration: 1888 ms	Memory Size: 128 MB	Max Memory Used: 81 MB	Init Duration: 202.96 ms

Coralogix logs

here's the output on coralogix:

image

from aws-lambda-extension.

tripodsan avatar tripodsan commented on August 19, 2024

a little bit better. but important levels, like error is still not working:

image

from aws-lambda-extension.

tripodsan avatar tripodsan commented on August 19, 2024

well, now the DEBUG is still missing:

image

from aws-lambda-extension.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.