forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoggableFactory.java
More file actions
37 lines (25 loc) · 1.14 KB
/
LoggableFactory.java
File metadata and controls
37 lines (25 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package sqlancer.common.log;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import sqlancer.common.query.Query;
public abstract class LoggableFactory {
public Loggable createLoggableWithNoLinebreak(String input) {
return createLoggable(input, "");
}
public Loggable createLoggable(String input) {
return createLoggable(input, "\n");
}
protected abstract Loggable createLoggable(String input, String suffix);
public abstract Query<?> getQueryForStateToReproduce(String queryString);
@Deprecated
public abstract Query<?> commentOutQuery(Query<?> query);
public Loggable getInfo(String databaseName, String databaseVersion, long seedValue) {
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
return infoToLoggable(dateFormat.format(date), databaseName, databaseVersion, seedValue);
}
protected abstract Loggable infoToLoggable(String time, String databaseName, String databaseVersion,
long seedValue);
public abstract Loggable convertStacktraceToLoggable(Throwable throwable);
}