当前位置: 首页>>代码示例>>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;未经允许,请勿转载。