Search in sources :

Example 56 with LambdaLogger

use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-lambda-developer-guide by awsdocs.

the class HandlerInteger method handleRequest.

@Override
public Integer handleRequest(Integer event, Context context) {
    LambdaLogger logger = context.getLogger();
    // process event
    logger.log("EVENT: " + gson.toJson(event));
    logger.log("EVENT TYPE: " + event.getClass().toString());
    // return amount of time remaining before timeout
    return context.getRemainingTimeInMillis();
}
Also used : LambdaLogger(com.amazonaws.services.lambda.runtime.LambdaLogger)

Example 57 with LambdaLogger

use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-lambda-developer-guide by awsdocs.

the class HandlerString method handleRequest.

@Override
public Integer handleRequest(String event, Context context) {
    LambdaLogger logger = context.getLogger();
    // process event
    logger.log("EVENT: " + gson.toJson(event));
    logger.log("EVENT TYPE: " + event.getClass().toString());
    return context.getRemainingTimeInMillis();
}
Also used : LambdaLogger(com.amazonaws.services.lambda.runtime.LambdaLogger)

Example 58 with LambdaLogger

use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-java-serverless by hermanlintvelt.

the class CreateRoadmapsHandlerTest method setUp.

@BeforeEach
public void setUp() {
    subject = new CreateRoadmapsHandler();
    testContext = new Context() {

        @Override
        public String getAwsRequestId() {
            return null;
        }

        @Override
        public String getLogGroupName() {
            return null;
        }

        @Override
        public String getLogStreamName() {
            return null;
        }

        // implement all methods of this interface and setup your test context.
        // For instance, the function name:
        @Override
        public String getFunctionName() {
            return "ExampleAwsLambda";
        }

        @Override
        public String getFunctionVersion() {
            return null;
        }

        @Override
        public String getInvokedFunctionArn() {
            return null;
        }

        @Override
        public CognitoIdentity getIdentity() {
            return null;
        }

        @Override
        public ClientContext getClientContext() {
            return null;
        }

        @Override
        public int getRemainingTimeInMillis() {
            return 0;
        }

        @Override
        public int getMemoryLimitInMB() {
            return 0;
        }

        @Override
        public LambdaLogger getLogger() {
            return null;
        }
    };
}
Also used : Context(com.amazonaws.services.lambda.runtime.Context) ClientContext(com.amazonaws.services.lambda.runtime.ClientContext) ClientContext(com.amazonaws.services.lambda.runtime.ClientContext) CognitoIdentity(com.amazonaws.services.lambda.runtime.CognitoIdentity) LambdaLogger(com.amazonaws.services.lambda.runtime.LambdaLogger) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 59 with LambdaLogger

use of com.amazonaws.services.lambda.runtime.LambdaLogger in project function-duke by ivargrimstad.

the class Hello method handleRequest.

public String handleRequest(Person person, Context context) {
    LambdaLogger logger = context.getLogger();
    logger.log("received : " + person.getName());
    return "Hello, " + person.getName();
}
Also used : LambdaLogger(com.amazonaws.services.lambda.runtime.LambdaLogger)

Aggregations

LambdaLogger (com.amazonaws.services.lambda.runtime.LambdaLogger)59 HashMap (java.util.HashMap)10 Date (java.util.Date)9 List (java.util.List)8 Map (java.util.Map)8 Context (com.amazonaws.services.lambda.runtime.Context)6 ApiAuthorizer (com.formkiq.lambda.apigateway.ApiAuthorizer)6 ApiGatewayRequestEvent (com.formkiq.lambda.apigateway.ApiGatewayRequestEvent)6 ApiGatewayRequestEventUtil (com.formkiq.lambda.apigateway.ApiGatewayRequestEventUtil)6 ApiGatewayRequestHandler (com.formkiq.lambda.apigateway.ApiGatewayRequestHandler)6 ApiRequestHandlerResponse (com.formkiq.lambda.apigateway.ApiRequestHandlerResponse)6 IOException (java.io.IOException)6 SC_OK (com.formkiq.lambda.apigateway.ApiResponseStatus.SC_OK)5 AwsServiceCache (com.formkiq.lambda.apigateway.AwsServiceCache)5 BadException (com.formkiq.lambda.apigateway.exception.BadException)5 DynamicObject (com.formkiq.stacks.common.objects.DynamicObject)5 Collectors (java.util.stream.Collectors)5 ClientContext (com.amazonaws.services.lambda.runtime.ClientContext)4 CognitoIdentity (com.amazonaws.services.lambda.runtime.CognitoIdentity)4 ApiMapResponse (com.formkiq.lambda.apigateway.ApiMapResponse)4