1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.oceanus.logger;
18
19
20
21
22 public class OceanusLogger {
23
24
25
26 private final OceanusLogManager theManager;
27
28
29
30
31 private final Class<?> theOwner;
32
33
34
35
36
37
38
39 public OceanusLogger(final OceanusLogManager pManager,
40 final Class<?> pOwner) {
41 theManager = pManager;
42 theOwner = pOwner;
43 }
44
45
46
47
48
49
50
51 public void debug(final String pFormat,
52 final Object... pArgs) {
53 final String myMessage = String.format(pFormat, pArgs);
54 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.DEBUG, myMessage);
55 theManager.writeLogMessage(myLogMessage);
56 }
57
58
59
60
61
62
63
64 public void debug(final String pMessage,
65 final byte[] pData) {
66 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.DEBUG, pMessage);
67 final String myLogData = OceanusLogManager.formatData(pData);
68 theManager.writeLogMessage(myLogMessage + myLogData);
69 }
70
71
72
73
74
75
76
77
78
79 public void debug(final String pMessage,
80 final byte[] pData,
81 final int pOffset,
82 final int pLength) {
83 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.DEBUG, pMessage);
84 final String myLogData = OceanusLogManager.formatData(pData, pOffset, pLength);
85 theManager.writeLogMessage(myLogMessage + myLogData);
86 }
87
88
89
90
91
92
93
94 public void info(final String pFormat,
95 final Object... pArgs) {
96 final String myMessage = String.format(pFormat, pArgs);
97 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.INFO, myMessage);
98 theManager.writeLogMessage(myLogMessage);
99 }
100
101
102
103
104
105
106
107 public void error(final String pFormat,
108 final Object... pArgs) {
109 final String myMessage = String.format(pFormat, pArgs);
110 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.ERROR, myMessage);
111 theManager.writeLogMessage(myLogMessage);
112 }
113
114
115
116
117
118
119
120 public void error(final String pMessage,
121 final Throwable pException) {
122 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.ERROR, pMessage);
123 theManager.writeLogMessage(myLogMessage, pException);
124 }
125
126
127
128
129
130
131
132 public void fatal(final String pFormat,
133 final Object... pArgs) {
134 final String myMessage = String.format(pFormat, pArgs);
135 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.FATAL, myMessage);
136 theManager.writeLogMessage(myLogMessage);
137 }
138
139
140
141
142
143
144
145 public void fatal(final String pMessage,
146 final Throwable pException) {
147 final String myLogMessage = theManager.formatMessage(theOwner, OceanusLogLevel.FATAL, pMessage);
148 theManager.writeLogMessage(myLogMessage, pException);
149 }
150 }