-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMockMetrics.java
More file actions
50 lines (41 loc) · 1.33 KB
/
MockMetrics.java
File metadata and controls
50 lines (41 loc) · 1.33 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
38
39
40
41
42
43
44
45
46
47
48
49
50
package dev.faststats;
import com.google.gson.JsonObject;
import dev.faststats.core.SimpleMetrics;
import dev.faststats.core.Token;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import java.io.IOException;
import java.net.URI;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@NullMarked
public class MockMetrics extends SimpleMetrics {
public MockMetrics(UUID serverId, @Token String token, boolean debug) {
super(new SimpleMetrics.Config(serverId, true, debug), Set.of(), token, URI.create("http://localhost:5000/v1/collect"), debug);
}
@Override
protected void printError(String message, @Nullable Throwable throwable) {
System.err.println(message);
if (throwable != null) throwable.printStackTrace(System.err);
}
@Override
protected void printInfo(String message) {
System.out.println(message);
}
@Override
protected void printWarning(String message) {
System.out.println(message);
}
@Override
public CompletableFuture<Boolean> submitAsync() throws IOException {
return super.submitAsync();
}
@Override
public JsonObject createData() {
return super.createData();
}
@Override
protected void appendDefaultData(JsonObject charts) {
}
}