public class JsonStepLogger extends Object implements StepLogger
| Constructor and Description |
|---|
JsonStepLogger(OutputStream outputStream)
Create a new logger that outputs to the stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the logger output, writes code to close the array and opened object:
// ]
// }
|
void |
start()
Start the object streaming, outputs start of the JSON object:
// {
// "steps" : [
|
void |
writeDoneFailed(String id)
Write information about incorrectly finished execution.
|
void |
writeDoneOK(String id)
Write information about successfully finished execution.
|
void |
writeError(String id,
Exception exception)
Write error with given exception information.
|
void |
writeError(String id,
String errorMessage)
Write error with given error message.
|
void |
writeError(String id,
String name,
String errorMessage)
Write error with given error name and error message, that is used as a description.
|
void |
writeError(String id,
String name,
String errorMessage,
Exception exception)
Write error with given error name and error message, that is used as a description.
|
void |
writeItem(String id,
String name,
String description,
String status,
Object object)
Writes a JSON object representing the step of the execution.
|
void |
writeServerCall(String id,
String uri,
String method,
Object requestObject,
Map<String,?> headers)
Write the information about the server call.
|
void |
writeServerCallConnectionError(String id,
Exception e)
Write error in case of a network issues.
|
void |
writeServerCallError(String id,
int statusCode,
Object responseObject,
Map<String,?> headers)
Write information about the failed server request.
|
void |
writeServerCallOK(String id,
Object responseObject,
Map<String,?> headers)
Write information about the successful server request.
|
public JsonStepLogger(OutputStream outputStream)
outputStream - Output stream.public void start()
start in interface StepLoggerpublic void writeItem(String id, String name, String description, String status, Object object)
writeItem in interface StepLoggerid - Step ID.name - Step name.description - Step detailed description.status - Step status result.object - Custom object associated with the step.public void writeServerCall(String id, String uri, String method, Object requestObject, Map<String,?> headers)
writeServerCall in interface StepLoggerid - Step ID.uri - URI that will be called.method - HTTP method of the call.requestObject - Request object, in case of the POST, PUT, DELETE method.headers - HTTP request headers.public void writeServerCallOK(String id, Object responseObject, Map<String,?> headers)
writeServerCallOK in interface StepLoggerid - Step ID.responseObject - HTTP response object.headers - HTTP response headers.public void writeServerCallError(String id, int statusCode, Object responseObject, Map<String,?> headers)
writeServerCallError in interface StepLoggerid - Step ID.statusCode - HTTP response status code.responseObject - HTTP response object.headers - HTTP response headers.public void close()
close in interface StepLoggerpublic void writeServerCallConnectionError(String id, Exception e)
writeServerCallConnectionError in interface StepLoggerid - Step ID.e - Network exception.public void writeError(String id, String errorMessage)
writeError in interface StepLoggerid - Step ID.errorMessage - Error message.public void writeError(String id, Exception exception)
writeError in interface StepLoggerid - Step ID.exception - Exception that should be logged.public void writeError(String id, String name, String errorMessage)
writeError in interface StepLoggerid - Step ID.name - Error name.errorMessage - Error message.public void writeError(String id, String name, String errorMessage, Exception exception)
writeError in interface StepLoggerid - Step ID.name - Error name.errorMessage - Error message.exception - Exception that caused the error.public void writeDoneOK(String id)
writeDoneOK in interface StepLoggerid - Step ID.public void writeDoneFailed(String id)
writeDoneFailed in interface StepLoggerid - Step ID.Copyright © 2016–2020 Wultra s.r.o.. All rights reserved.