-
Notifications
You must be signed in to change notification settings - Fork 0
/
ControllerLogger.java
36 lines (27 loc) · 958 Bytes
/
ControllerLogger.java
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
import java.io.IOException;
import java.net.Socket;
public class ControllerLogger extends Logger {
private static final String LOG_FILE_SUFFIX = "controller";
private static ControllerLogger instance = null;
public static void init(LoggingType loggingType) throws IOException {
if (instance == null)
instance = new ControllerLogger(loggingType);
else
throw new IOException("ControllerLogger already initialised");
}
public static ControllerLogger getInstance() {
if (instance == null)
throw new RuntimeException("ControllerLogger has not been initialised yet");
return instance;
}
protected ControllerLogger(LoggingType loggingType) throws IOException {
super(loggingType);
}
@Override
protected String getLogFileSuffix() {
return LOG_FILE_SUFFIX;
}
public void dstoreJoined(Socket socket, int dstorePort) {
log("[New Dstore " + dstorePort + " " + socket.getLocalPort() + "<-" + socket.getPort() + "]");
}
}