Skip to content

Commit

Permalink
Merge pull request #33 from agorapulse/fix/remove-logging-interfaces
Browse files Browse the repository at this point in the history
Fix/remove logging interfaces
  • Loading branch information
musketyr committed Jul 11, 2022
2 parents cfacba0 + 8bf0ad0 commit ecc43af
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 223 deletions.
22 changes: 20 additions & 2 deletions docs/guide/src/docs/asciidoc/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,23 @@ You can extend `LoggingFunctionInitializer` instead of `FunctionInitializer` to

=== Using Logging Request Handlers

Yuu can extend either `LoggingRequestHandler` or `LoggingRequestStreamHandler` to ensure the error is logged from the `handleRequest` methods.
You can use `LoggingFunction` and `LoggingConsumer` in case of using the interfaces from `java.util.function` package instead of AWS specific ones.
You can use `Logging` class to ensure the errors are logged properly:

[source,java]
----
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class LoggingRequestHandler extends RequestHandler<Input, Output> {
@Override
public Output handleRequest(Input input, Context context) {
return Logging.callAndRethrow(getClass(), "Exception running handler", () -> doHandleRequest(input, context));
}
private Output doHandleRequest(Input input, Context context) {
// ...
}
}
----

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit ecc43af

Please sign in to comment.