Name: scipio
Owner: D3adspace Enterprises
Description: Failure reporting in an efficient and highly customizable way.
Created: 2017-07-02 17:29:40.0
Updated: 2017-07-25 16:22:32.0
Pushed: 2017-07-23 13:09:33.0
Size: 36
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
What you see here is a lightweight but robust and powerful error reporting framework without any external dependencies. You can use custom handlers to broadcast failure descriptions across your internal network. You can provide those failures in an enumeration or built a fully custom one.
By adding a handler you can control how your failures will be handled. You can post them to a RESTful service or just save them in a database to be reviewed from a monitor application.
Scipio provides two basic examples for a logger located at https://github.com/D3adspaceEnterprises/scipio/tree/master/src/main/java/de/d3adspace/scipio/handler/logger
`mvn clean install
`Maven dependencies
Scipio:
endency>
<groupId>de.d3adspace</groupId>
<artifactId>scipio-core</artifactId>
<version>1.0-SNAPSHOT</version>
pendency>
Setting up Scipio with a handler that prints all failures:
rt de.d3adspace.scipio.core.Scipio;
rt de.d3adspace.scipio.core.ScipioFactory;
rt de.d3adspace.scipio.core.description.FailureDescription;
rt de.d3adspace.scipio.core.description.FailureDescriptionBuilder;
rt de.d3adspace.scipio.core.description.FailureDescriptionFactory;
rt de.d3adspace.scipio.core.handler.FailureHandler;
rt de.d3adspace.scipio.core.priority.Priority;
author Felix 'SasukeKawaii' Klauke
ic class ScipioTest {
public static void main(String[] args) {
Scipio scipio = ScipioFactory.createScipio();
scipio.addFailureHandler(System.out::println);
}
Handle a failure:
ureDescription description = FailureDescriptionFactory.createFailureDescription("Human", "Organs", "CompleteFailure", Priority.CRITICAL);
io.handleFailure(description);
Provide the failure with an enum:
ureDescription description = FailureDescriptionFactory.createFailureDescription(ScipioTestFailures.COMPLETE_ORGANIC_FAILURE);
io.handleFailure(description);
ava
rt de.d3adspace.scipio.core.priority.Priority;
rt de.d3adspace.scipio.core.provider.FailureProvider;
author Felix 'SasukeKawaii' Klauke
ic enum ScipioTestFailures implements FailureProvider {
COMPLETE_ORGANIC_FAILURE("Human", "Organs", "CompleteFailure", Priority.CRITICAL),
SCRATCH("Human", "Epidermis", "splinter", Priority.WARNING);
private final String system;
private final String application;
private final String failure;
private final Priority priority;
ScipioTestFailures(String system, String application, String failure,
Priority priority) {
this.system = system;
this.application = application;
this.failure = failure;
this.priority = priority;
}
@Override
public String getFailure() {
return failure;
}
@Override
public String getSystem() {
return system;
}
@Override
public String getApplication() {
return application;
}
@Override
public Priority getPriority() {
return priority;
}
Build a failure on your own:
ureDescription description = new FailureDescriptionBuilder()
.setSystem("Custom")
.setApplication("Error")
.setFailure("example")
.setTimestamp(System.currentTimeMillis())
.setPriority(Priority.WARNING)
.createSimpleFailureDescription();
Work with meta data:
ureDescription description = FailureDescriptionFactory.createFailureDescription(ScipioTestFailures.SCRATCH);
ription.getMetadata().addMetadataEntry("depth", "5 millimeters");