-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.java
More file actions
40 lines (32 loc) · 912 Bytes
/
Logger.java
File metadata and controls
40 lines (32 loc) · 912 Bytes
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
import java.util.ArrayList;
public class Logger {
private int time;
private int count;
private ArrayList<Log> logs;
public Logger() {
this.time = 0;
this.count = 0;
this.logs = new ArrayList<>();
}
public void incrementTime(int t) {
this.time += t;
}
public void incrementCount() {
this.count++;
}
public int getTime() {
return this.time;
}
public int getCount() {
return this.count;
}
public void addLog(Log log) {
this.logs.add(log);
}
public void printLogs() {
System.out.println("ID\tLevel\tStart\tEnd");
for (Log log : this.logs) {
System.out.println(log);
}
}
}