Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Demonstrate a more capable ObjectAppendingMarker and Marker-builder API

Notifications You must be signed in to change notification settings

poblish/logback-encoder-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

logback-encoder-test

Goals:

  1. Establish (via tests) how the net.logstash.logback.encoder.LogstashEncoder behaves with various different types of Marker payload, including byte[], Enumeration, Optional, BigInteger, BigDecimal, Stream, Iterator, Iterable, etc. For example:

    import static org.test.OurMarkers.append;
    
    LogstashMarker m = append("Bytes", "གུ་གེ་ཚེ་རིང་རྒྱལ་པོ་".getBytes(Charsets.UTF_8));
    assertThat( markerToString(m) ).contains("\"Bytes\":\"གུ་གེ་ཚེ་རིང་རྒྱལ་པོ་\"");
    
    ...
    
    Enumeration<String> e = new Vector<>(Arrays.asList("製品に関する重要なお知らせ", "b", "c")).elements();
    LogstashMarker m = append("Enum", e);
    
    assertThat( markerToString(m) ).contains("\"Enum\":[\"製品に関する重要なお知らせ\",\"b\",\"c\"]");
    
    ...
    
    assertThat( markerToString( append("Opt", Optional.of("hello")) ) ).contains("\"Opt\":\"hello\"");
    assertThat( markerToString( append("Opt", Optional.empty()) ) ).contains("\"Opt\":\"<missing>\"");
  2. Demonstrate a (hopefully) more helpful API for joining multiple Markers for a SLF4J log event. For example:

    import org.apache.commons.lang3.tuple.Pair;
    
    import static org.test.OurMarkers.with;
    
    ...
    
    logger.info( with(marker1, marker2, marker3), "event");
    
    logger.info( with( Pair.of("a","b"), Pair.of("c","d")), "event");

About

Demonstrate a more capable ObjectAppendingMarker and Marker-builder API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages