當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonProviders類代碼示例

本文整理匯總了Java中net.logstash.logback.composite.JsonProviders的典型用法代碼示例。如果您正苦於以下問題:Java JsonProviders類的具體用法?Java JsonProviders怎麽用?Java JsonProviders使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JsonProviders類屬於net.logstash.logback.composite包,在下文中一共展示了JsonProviders類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: overrideLogLevelProvider

import net.logstash.logback.composite.JsonProviders; //導入依賴的package包/類
@Test
public void overrideLogLevelProvider() {
    SixtJsonEncoder encoder = new SixtJsonEncoder();
    JsonProviders<ILoggingEvent> providers = encoder.getProviders();
    int defaultCount = 0;
    int overrideCount = 0;

    for (JsonProvider<ILoggingEvent> provider : providers.getProviders()) {
        if (provider instanceof LogLevelJsonProvider &&
                !(provider instanceof CustomLogLevelJsonProvider)) {
            defaultCount++;
        } else if (provider instanceof CustomLogLevelJsonProvider) {
            overrideCount++;
        }
    }
    assertThat(defaultCount).isEqualTo(0);
    assertThat(overrideCount).isEqualTo(1);
}
 
開發者ID:Sixt,項目名稱:ja-micro,代碼行數:19,代碼來源:SixtJsonEncoderTest.java

示例2: get

import net.logstash.logback.composite.JsonProviders; //導入依賴的package包/類
@Override
public LogstashLayout get() {
    checkState(buildId.isPresent(), "buildId has not been set");
    final LogstashLayout layout = new LogstashLayout();
    /**
     * Gradle doesn't include a complete SLF4J implementation, so when the provider tries to access MDC
     * features a warning is output. So we need to expose a method to remove the provider.
     */
    JsonProviders<ILoggingEvent> providers = layout.getProviders();
    MdcJsonProvider provider = FluentIterable.from(providers.getProviders()).filter(MdcJsonProvider.class).first().get();
    layout.getProviders().removeProvider(provider);
    layout.setTimeZone("UTC");
    layout.setCustomFields(String.format("{\"@source\":\"%s\"}", buildId.get()));
    layout.start();
    return layout;
}
 
開發者ID:nebula-plugins,項目名稱:gradle-metrics-plugin,代碼行數:17,代碼來源:AbstractESMetricsDispatcher.java

示例3: setProviderItems

import net.logstash.logback.composite.JsonProviders; //導入依賴的package包/類
@SuppressWarnings({ CompilerWarnings.UNCHECKED })
public void setProviderItems(JsonProvider<ILoggingEvent> ... provs) {
    JsonProviders<ILoggingEvent> provsContainer = this.getProviders();

    Stream.of(provs).forEach(provsContainer::addProvider);
}
 
開發者ID:esacinc,項目名稱:sdcct,代碼行數:7,代碼來源:SdcctLogstashEncoder.java


注:本文中的net.logstash.logback.composite.JsonProviders類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。