mirror of
https://github.com/tiennm99/tjahzi.git
synced 2026-10-20 02:18:25 +00:00
Re #9: Cleanup.
This commit is contained in:
1 parent
cdc1cf3ead
commit
e96f28fb79
1 file changed
+24
-2
@@ -30,6 +30,30 @@ public class TjahziLogger {
|
||||
);
|
||||
|
||||
int claim = logBuffer.tryClaim(LOG_MESSAGE_TYPE_ID, requiredSize);
|
||||
if (claim > 0) {
|
||||
putMessageOnRing(
|
||||
timestamp,
|
||||
labels,
|
||||
logLevelLabel,
|
||||
logLevel,
|
||||
line,
|
||||
claim
|
||||
);
|
||||
} else {
|
||||
// TODO: increment dropped lines metric
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void putMessageOnRing(
|
||||
long timestamp,
|
||||
Map<String, String> labels,
|
||||
String logLevelLabel,
|
||||
String logLevel,
|
||||
ByteBuffer line,
|
||||
int claim
|
||||
) {
|
||||
try {
|
||||
serializer
|
||||
.writeTo(
|
||||
@@ -45,7 +69,5 @@ public class TjahziLogger {
|
||||
} catch (Throwable t) {
|
||||
logBuffer.abort(claim);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user