forked from ringcentral/pubnub-jtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractLogger.java
More file actions
45 lines (32 loc) · 1.11 KB
/
Copy pathAbstractLogger.java
File metadata and controls
45 lines (32 loc) · 1.11 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
package com.pubnub.api;
abstract class AbstractLogger {
private static boolean LOGGING = false;
private static String VERSION = "";
protected abstract void nativeDebug(String s);
protected abstract void nativeVerbose(String s);
protected abstract void nativeError(String s);
protected abstract void nativeInfo(String s);
private String prepareString(String s) {
return "[" + VERSION + "] : " + "[" + System.currentTimeMillis() + "] : " +
"["+Thread.activeCount() +
"] Thread HashCode : " + Thread.currentThread().hashCode() +
", Thread Name : " + Thread.currentThread().getName() +
", " + s;
}
public void debug(String s) {
if (LOGGING)
nativeDebug(prepareString(s));
}
public void verbose(String s) {
if (LOGGING)
nativeVerbose(prepareString(s));
}
public void info(String s) {
if (LOGGING)
nativeInfo(prepareString(s));
}
public void error(String s) {
if (LOGGING)
nativeError(prepareString(s));
}
}