public class JsonLogCollector extends java.lang.Object implements ILogCollector
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONTENT_TYPE |
| Constructor and Description |
|---|
JsonLogCollector() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
collect()
Create complete stream chunk in JSON string, stored as UTF-8 bytes.
|
java.lang.String |
collectAsString()
Create complete stream chunk in JSON string.
|
java.lang.String |
contentType()
Used in HTTP Content-Type header.
|
ILogStream |
createStream(Labels labels)
Creates new instance of stream which will notify this collector about new logs.
|
void |
onStreamReleased(ILogStream stream)
Given stream will not be flushed by this log collector anymore, so given stream will accumulate
all next logs causing memory leaks (if it will not be garbage collected).
|
int |
waitForLogs(long timeout)
Blocking function.
|
public static final java.lang.String CONTENT_TYPE
public ILogStream createStream(Labels labels)
createStream in interface ILogCollectorlabels - Unique set of labels.public void onStreamReleased(ILogStream stream)
JsonLogStream.release(), so there is no need to call it directly.stream - Stream to release.public byte[] collect()
collect in interface ILogCollectorpublic java.lang.String collectAsString()
public java.lang.String contentType()
contentType in interface ILogCollectorpublic int waitForLogs(long timeout)
throws java.lang.InterruptedException
waitForLogs in interface ILogCollectortimeout - Time in milliseconds.java.lang.InterruptedException - When this thread is interrupted during waiting.