当前位置: 首页>>代码示例>>Java>>正文


Java BasicMarkerFactory类代码示例

本文整理汇总了Java中org.slf4j.helpers.BasicMarkerFactory的典型用法代码示例。如果您正苦于以下问题:Java BasicMarkerFactory类的具体用法?Java BasicMarkerFactory怎么用?Java BasicMarkerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicMarkerFactory类属于org.slf4j.helpers包,在下文中一共展示了BasicMarkerFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testHomonyms

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
public void testHomonyms() {
    final String diffPrefix = "homonym" + diff;
    final String PARENT_NAME = diffPrefix + PARENT_MARKER_STR;
    final String CHILD_NAME = diffPrefix + CHILD_MARKER_STR;
    Marker parent = factory.getMarker(PARENT_NAME);
    Marker child = factory.getMarker(CHILD_NAME);
    parent.add(child);

    IMarkerFactory otherFactory = new BasicMarkerFactory();
    Marker otherParent = otherFactory.getMarker(PARENT_NAME);
    Marker otherChild = otherFactory.getMarker(CHILD_NAME);

    assertTrue(parent.contains(otherParent));
    assertTrue(parent.contains(otherChild));

    assertTrue(parent.remove(otherChild));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:18,代码来源:BasicMarkerTest.java

示例2: testMarker

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testMarker() {
    Logger logger = LoggerFactory.getLogger("testMarker");
    
    IMarkerFactory markerFactory = new BasicMarkerFactory();
    
    Marker blue = markerFactory.getMarker("BLUE");
    logger.debug(blue, "hello");
    logger.info(blue, "hello");
    logger.warn(blue, "hello");
    logger.error(blue, "hello");

    logger.debug(blue, "hello {}", "world");
    logger.info(blue, "hello {}", "world");
    logger.warn(blue, "hello {}", "world");
    logger.error(blue, "hello {}", "world");

    logger.debug(blue, "hello {} and {} ", "world", "universe");
    logger.info(blue, "hello {} and {} ", "world", "universe");
    logger.warn(blue, "hello {} and {} ", "world", "universe");
    logger.error(blue, "hello {} and {} ", "world", "universe");
}
 
开发者ID:jretty-org,项目名称:jretty-log,代码行数:23,代码来源:Slf4jAPITest.java

示例3: BasicMarkerTest

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
public BasicMarkerTest() {
    factory = new BasicMarkerFactory();

    blue = factory.getMarker(BLUE_STR);
    red = factory.getMarker(RED_STR);
    green = factory.getMarker(GREEN_STR);
    comp = factory.getMarker(COMP_STR);
    comp.add(blue);

    multiComp = factory.getMarker(MULTI_COMP_STR);
    multiComp.add(green);
    multiComp.add(comp);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:14,代码来源:BasicMarkerTest.java

示例4: testAddMarker

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testAddMarker() throws Exception {
  //given
  final Marker marker = new BasicMarkerFactory().getMarker("some marker");

  //when
  LogbackUtil.addMarker(marker, new HashMap<>(), builder);

  //then
  assertEquals(builder.build().getMarkerColors(), MarkerColors.Aqua);
  assertTrue(builder.build().isMarked());
  assertEquals(builder.build().getProperties().get("marker"), "some marker");
}
 
开发者ID:otros-systems,项目名称:otroslogviewer,代码行数:14,代码来源:LogbackUtilTest.java

示例5: logMarker

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void logMarker() throws InterruptedException {
    Marker sendEmailMarker = new BasicMarkerFactory().getMarker("SEND_EMAIL");
    LOG.debug(sendEmailMarker, "Test the marker 1.");
    LOG.debug(sendEmailMarker, "Test the marker 2.");

    Thread.sleep(1000);
}
 
开发者ID:linux-china,项目名称:logback-fluentd-appender,代码行数:9,代码来源:LogbackAppenderTest.java

示例6: logNestedMarker

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void logNestedMarker() throws InterruptedException {
    Marker notifyMarker = new BasicMarkerFactory().getMarker("NOTIFY");
    Marker sendEmailMarker = new BasicMarkerFactory().getMarker("SEND_EMAIL");
    sendEmailMarker.add(notifyMarker);
    LOG.debug(sendEmailMarker, "Test the nested marker 1.");
    LOG.debug(sendEmailMarker, "Test the nested marker 2.");

    Thread.sleep(1000);
}
 
开发者ID:linux-china,项目名称:logback-fluentd-appender,代码行数:11,代码来源:LogbackAppenderTest.java

示例7: testIsArrayStenoEvent

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testIsArrayStenoEvent() throws Exception {
    final Marker rootMarker = new BasicMarkerFactory().getMarker("foo");
    rootMarker.add(StenoMarker.ARRAY_MARKER);
    Assert.assertTrue(_encoder.isArrayStenoEvent(StenoMarker.ARRAY_MARKER));
    Assert.assertTrue(_encoder.isArrayStenoEvent(rootMarker));
    Assert.assertFalse(_encoder.isArrayStenoEvent(StenoMarker.ARRAY_JSON_MARKER));
    Assert.assertFalse(_encoder.isArrayStenoEvent(StenoMarker.MAP_MARKER));
    Assert.assertFalse(_encoder.isArrayStenoEvent(StenoMarker.MAP_JSON_MARKER));
    Assert.assertFalse(_encoder.isArrayStenoEvent(StenoMarker.OBJECT_MARKER));
    Assert.assertFalse(_encoder.isArrayStenoEvent(StenoMarker.OBJECT_JSON_MARKER));
}
 
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:13,代码来源:BaseLoggingEncoderTest.java

示例8: testIsArrayJsonStenoEvent

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testIsArrayJsonStenoEvent() throws Exception {
    final Marker rootMarker = new BasicMarkerFactory().getMarker("foo");
    rootMarker.add(StenoMarker.ARRAY_JSON_MARKER);
    Assert.assertTrue(_encoder.isArrayJsonStenoEvent(StenoMarker.ARRAY_JSON_MARKER));
    Assert.assertTrue(_encoder.isArrayJsonStenoEvent(rootMarker));
    Assert.assertFalse(_encoder.isArrayJsonStenoEvent(StenoMarker.ARRAY_MARKER));
    Assert.assertFalse(_encoder.isArrayJsonStenoEvent(StenoMarker.MAP_MARKER));
    Assert.assertFalse(_encoder.isArrayJsonStenoEvent(StenoMarker.MAP_JSON_MARKER));
    Assert.assertFalse(_encoder.isArrayJsonStenoEvent(StenoMarker.OBJECT_MARKER));
    Assert.assertFalse(_encoder.isArrayJsonStenoEvent(StenoMarker.OBJECT_JSON_MARKER));
}
 
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:13,代码来源:BaseLoggingEncoderTest.java

示例9: testIsMapStenoEvent

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testIsMapStenoEvent() throws Exception {
    final Marker rootMarker = new BasicMarkerFactory().getMarker("foo");
    rootMarker.add(StenoMarker.MAP_MARKER);
    Assert.assertTrue(_encoder.isMapStenoEvent(StenoMarker.MAP_MARKER));
    Assert.assertTrue(_encoder.isMapStenoEvent(rootMarker));
    Assert.assertFalse(_encoder.isMapStenoEvent(StenoMarker.MAP_JSON_MARKER));
    Assert.assertFalse(_encoder.isMapStenoEvent(StenoMarker.ARRAY_MARKER));
    Assert.assertFalse(_encoder.isMapStenoEvent(StenoMarker.ARRAY_JSON_MARKER));
    Assert.assertFalse(_encoder.isMapStenoEvent(StenoMarker.OBJECT_MARKER));
    Assert.assertFalse(_encoder.isMapStenoEvent(StenoMarker.OBJECT_JSON_MARKER));
}
 
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:13,代码来源:BaseLoggingEncoderTest.java

示例10: testIsMapJsonStenoEvent

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testIsMapJsonStenoEvent() throws Exception {
    final Marker rootMarker = new BasicMarkerFactory().getMarker("foo");
    rootMarker.add(StenoMarker.MAP_JSON_MARKER);
    Assert.assertTrue(_encoder.isMapJsonStenoEvent(StenoMarker.MAP_JSON_MARKER));
    Assert.assertTrue(_encoder.isMapJsonStenoEvent(rootMarker));
    Assert.assertFalse(_encoder.isMapJsonStenoEvent(StenoMarker.MAP_MARKER));
    Assert.assertFalse(_encoder.isMapJsonStenoEvent(StenoMarker.ARRAY_MARKER));
    Assert.assertFalse(_encoder.isMapJsonStenoEvent(StenoMarker.ARRAY_JSON_MARKER));
    Assert.assertFalse(_encoder.isMapJsonStenoEvent(StenoMarker.OBJECT_MARKER));
    Assert.assertFalse(_encoder.isMapJsonStenoEvent(StenoMarker.OBJECT_JSON_MARKER));
}
 
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:13,代码来源:BaseLoggingEncoderTest.java

示例11: testIsObjectStenoEvent

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testIsObjectStenoEvent() throws Exception {
    final Marker rootMarker = new BasicMarkerFactory().getMarker("foo");
    rootMarker.add(StenoMarker.OBJECT_MARKER);
    Assert.assertTrue(_encoder.isObjectStenoEvent(StenoMarker.OBJECT_MARKER));
    Assert.assertTrue(_encoder.isObjectStenoEvent(rootMarker));
    Assert.assertFalse(_encoder.isObjectStenoEvent(StenoMarker.MAP_MARKER));
    Assert.assertFalse(_encoder.isObjectStenoEvent(StenoMarker.MAP_JSON_MARKER));
    Assert.assertFalse(_encoder.isObjectStenoEvent(StenoMarker.ARRAY_MARKER));
    Assert.assertFalse(_encoder.isObjectStenoEvent(StenoMarker.ARRAY_JSON_MARKER));
    Assert.assertFalse(_encoder.isObjectStenoEvent(StenoMarker.OBJECT_JSON_MARKER));
}
 
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:13,代码来源:BaseLoggingEncoderTest.java

示例12: testIsObjectJsonStenoEvent

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
@Test
public void testIsObjectJsonStenoEvent() throws Exception {
    final Marker rootMarker = new BasicMarkerFactory().getMarker("foo");
    rootMarker.add(StenoMarker.OBJECT_JSON_MARKER);
    Assert.assertTrue(_encoder.isObjectJsonStenoEvent(StenoMarker.OBJECT_JSON_MARKER));
    Assert.assertTrue(_encoder.isObjectJsonStenoEvent(rootMarker));
    Assert.assertFalse(_encoder.isObjectJsonStenoEvent(StenoMarker.MAP_MARKER));
    Assert.assertFalse(_encoder.isObjectJsonStenoEvent(StenoMarker.MAP_JSON_MARKER));
    Assert.assertFalse(_encoder.isObjectJsonStenoEvent(StenoMarker.ARRAY_MARKER));
    Assert.assertFalse(_encoder.isObjectJsonStenoEvent(StenoMarker.ARRAY_JSON_MARKER));
    Assert.assertFalse(_encoder.isObjectJsonStenoEvent(StenoMarker.OBJECT_MARKER));
}
 
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:13,代码来源:BaseLoggingEncoderTest.java

示例13: StartReportingMetricsToSLF4J

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
public StartReportingMetricsToSLF4J(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
  super(builder, config, parent, child, context);      
  
  MetricFilter filter = PatternMetricFilter.parse(getConfigs(), config);
  TimeUnit defaultDurationUnit = getConfigs().getTimeUnit(config, "defaultDurationUnit", TimeUnit.MILLISECONDS);
  TimeUnit defaultRateUnit = getConfigs().getTimeUnit(config, "defaultRateUnit", TimeUnit.SECONDS); 
  long frequency = getConfigs().getNanoseconds(config, "frequency", 10 * 1000L * 1000 * 1000); // 10 secs, also see https://github.com/typesafehub/config/blob/master/HOCON.md#duration-format
  this.logger = getConfigs().getString(config, "logger", "metrics");
  String marker = getConfigs().getString(config, "marker", null);      
  validateArguments();
  
  MetricRegistry registry = context.getMetricRegistry();
  synchronized (REGISTRIES) {
    Map<String, Slf4jReporter> reporters = REGISTRIES.get(registry);
    if (reporters == null) {
      reporters = new HashMap();
      REGISTRIES.put(registry, reporters);
    }
    Slf4jReporter reporter = reporters.get(logger);
    if (reporter == null) {
      Builder reporterBuilder = Slf4jReporter.forRegistry(registry)
          .filter(filter)
          .convertDurationsTo(defaultDurationUnit)
          .convertRatesTo(defaultRateUnit)
          .outputTo(LoggerFactory.getLogger(logger));
      
      if (marker != null) {
        reporterBuilder = reporterBuilder.markWith(new BasicMarkerFactory().getMarker(marker));
      }
          
      reporter = reporterBuilder.build();
      reporter.start(frequency, TimeUnit.NANOSECONDS);
      reporters.put(logger, reporter);
    }
  }
}
 
开发者ID:cloudera,项目名称:cdk,代码行数:37,代码来源:StartReportingMetricsToSLF4JBuilder.java

示例14: getMarkerFactoryClassStr

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
/**
 * Currently, this method returns the class name of
 * {@link BasicMarkerFactory}.
 */
@Override
public String getMarkerFactoryClassStr() {
    return BasicMarkerFactory.class.getName();
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:9,代码来源:StaticMarkerBinder.java

示例15: getMarkerFactoryClassStr

import org.slf4j.helpers.BasicMarkerFactory; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String getMarkerFactoryClassStr() {
    return BasicMarkerFactory.class.getName();
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:8,代码来源:StaticMarkerBinder.java


注:本文中的org.slf4j.helpers.BasicMarkerFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。