use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-lambda-developer-guide by awsdocs.
the class HandlerCWEvents method handleRequest.
@Override
public String handleRequest(ScheduledEvent event, Context context) {
LambdaLogger logger = context.getLogger();
String response = new String("200 OK");
// log execution details
Util.logEnvironment(event, context, gson);
return response;
}
use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-lambda-developer-guide by awsdocs.
the class HandlerCWLogs method handleRequest.
@Override
public String handleRequest(CloudWatchLogsEvent event, Context context) {
LambdaLogger logger = context.getLogger();
String response = new String("200 OK");
Decoder decoder = Base64.getDecoder();
byte[] decodedEvent = decoder.decode(event.getAwsLogs().getData());
StringBuilder output = new StringBuilder();
try {
GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(decodedEvent));
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
bufferedReader.lines().forEach(line -> {
logger.log(line);
output.append(line);
});
logger.log(output.toString());
} catch (IOException e) {
logger.log("ERROR: " + e.toString());
}
// log execution details
Util.logEnvironment(event, context, gson);
return response;
}
use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-lambda-developer-guide by awsdocs.
the class HandlerCloudFront method handleRequest.
@Override
public String handleRequest(CloudFrontEvent event, Context context) {
LambdaLogger logger = context.getLogger();
String response = new String("200 OK");
// log execution details
Util.logEnvironment(event, context, gson);
return response;
}
use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-lambda-developer-guide by awsdocs.
the class HandlerCodeCommit method handleRequest.
@Override
public String handleRequest(CodeCommitEvent event, Context context) {
LambdaLogger logger = context.getLogger();
String response = new String("200 OK");
// log execution details
Util.logEnvironment(event, context, gson);
return response;
}
use of com.amazonaws.services.lambda.runtime.LambdaLogger in project aws-lambda-developer-guide by awsdocs.
the class HandlerLex method handleRequest.
@Override
public String handleRequest(LexEvent event, Context context) {
LambdaLogger logger = context.getLogger();
String response = new String("200 OK");
// log execution details
Util.logEnvironment(event, context, gson);
return response;
}
Aggregations