Search in sources :

Example 1 with LogFormatter

use of com.yahoo.logserver.formatter.LogFormatter in project vespa by vespa-engine.

the class ReplicatorConnection method onListFormatters.

void onListFormatters() {
    print("# 206 formatter list\n");
    String[] formatterNames = LogFormatterManager.getFormatterNames();
    for (int i = 0; i < formatterNames.length; i++) {
        LogFormatter fmt = LogFormatterManager.getLogFormatter(formatterNames[i]);
        print("# 207 " + formatterNames[i] + " - " + fmt.description() + "\n");
    }
    print("# 208 end formatter list\n");
}
Also used : LogFormatter(com.yahoo.logserver.formatter.LogFormatter)

Example 2 with LogFormatter

use of com.yahoo.logserver.formatter.LogFormatter in project vespa by vespa-engine.

the class ReplicatorConnection method onFormatter.

void onFormatter(String formatterName) {
    LogFormatter newFormatter = LogFormatterManager.getLogFormatter(formatterName);
    if (newFormatter == null) {
        print("# 405 formatter not found '" + formatterName + "'\n");
        return;
    }
    formatter = newFormatter;
    this.formatterName = formatterName;
    print("# 202 using '" + formatter + "'\n");
}
Also used : LogFormatter(com.yahoo.logserver.formatter.LogFormatter)

Example 3 with LogFormatter

use of com.yahoo.logserver.formatter.LogFormatter in project vespa by vespa-engine.

the class LogFormatterManagerTestCase method testSystemFormatters.

/**
 * Ensure the system formatters are present
 */
@Test
public void testSystemFormatters() {
    LogFormatter lf = LogFormatterManager.getLogFormatter("system.textformatter");
    assertNotNull(lf);
    assertEquals(TextFormatter.class, lf.getClass());
    lf = LogFormatterManager.getLogFormatter("system.nullformatter");
    assertNotNull(lf);
    assertEquals(NullFormatter.class, lf.getClass());
}
Also used : LogFormatter(com.yahoo.logserver.formatter.LogFormatter)

Example 4 with LogFormatter

use of com.yahoo.logserver.formatter.LogFormatter in project vespa by vespa-engine.

the class FormattedBufferCacheTestCase method testCache.

@Test
public void testCache() {
    LogMessage[] msgs = MockLogEntries.getMessages();
    FormattedBufferCache cache = new FormattedBufferCache();
    String[] n = LogFormatterManager.getFormatterNames();
    for (int i = 0; i < n.length; i++) {
        LogFormatter f = LogFormatterManager.getLogFormatter(n[i]);
        for (int j = 0; j < msgs.length; j++) {
            ByteBuffer bb = cache.getFormatted(msgs[j], f);
            assertNotNull(bb);
        }
    }
    assertTrue(cache.getUnderlyingMapOnlyForTesting().size() > 0);
    cache.reset();
    assertTrue(cache.getUnderlyingMapOnlyForTesting().size() == 0);
}
Also used : LogMessage(com.yahoo.log.LogMessage) FormattedBufferCache(com.yahoo.logserver.handlers.replicator.FormattedBufferCache) LogFormatter(com.yahoo.logserver.formatter.LogFormatter) ByteBuffer(java.nio.ByteBuffer)

Aggregations

LogFormatter (com.yahoo.logserver.formatter.LogFormatter)4 LogMessage (com.yahoo.log.LogMessage)1 FormattedBufferCache (com.yahoo.logserver.handlers.replicator.FormattedBufferCache)1 ByteBuffer (java.nio.ByteBuffer)1