Skip to content

Commit

Permalink
Merge pull request #17 from dm-drogeriemarkt/keyvalue
Browse files Browse the repository at this point in the history
remove key-value assertion again
  • Loading branch information
cleaning-agent authored Sep 26, 2022
2 parents c9cde5c + 9fa1e84 commit 01eebbe
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 423 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ jobs:
with:
COMMAND: >
mvn --batch-mode -Dmaven.compiler.showDeprecation=true -Dmaven.compiler.showWarnings=true -Dproject.version=0.0.0-SNAPSHOT clean install
&& cd project-without-logstash
&& mvn --batch-mode -Dlog-capture.version=0.0.0-SNAPSHOT clean verify
26 changes: 5 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ logCapture.assertLoggedInOrder(
* [Exceptions](#exceptions)
* [Markers](#markers)
* [Logger name](#logger-name)
* [Key-Value (from Logstash)](#key-value-from-logstash)
* [Examples](#examples)
* [Unit Test Example:](#unit-test-example)
* [Integration Test Example:](#integration-test-example)
Expand All @@ -50,6 +49,7 @@ logCapture.assertLoggedInOrder(
* [Cucumber example](#cucumber-example)
* [Cucumber feature file](#cucumber-feature-file)
* [Changes](#changes)
* [3.6.0](#360)
* [3.5.0](#350)
* [3.4.1](#341)
* [3.4.0](#340)
Expand Down Expand Up @@ -141,26 +141,6 @@ log.info("did something");
logCapture.info("did something", logger("com.acme.foo"));
```

#### Key-Value (from Logstash)

**Note that** this will only work if logstash-logback-encoder is in your classpath - log-capture does not depend on it, so you need to add it manually if you intend to use it.

```java
import static de.dm.infrastructure.logcapture.ExpectedKeyValue.keyValue;

...

log.info("hello",
StructuredArguments.keyValue("myString", "hello"),
StructuredArguments.keyValue("myNumber", 42)
);

logCapture.assertLogged(info("hello",
keyValue("myString", "hello"),
keyValue("myNumber", 42))
);
```

### Examples

#### Unit Test Example:
Expand Down Expand Up @@ -328,6 +308,10 @@ And with MDC logging context

## Changes

### 3.6.0

* Removed ExpectedKeyValue again due to an [API change in Logstash without a workaround](https://github.com/logfellow/logstash-logback-encoder/issues/788)

### 3.5.0

* Added new Log Event Matcher: `ExpectedKeyValue.keyValue(...)` to assert `StructuredArguments.keyValue(...)` from Logstash
Expand Down
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<java.version>1.8</java.version>
<lombok.version>1.18.22</lombok.version>
<logback.version>1.2.11</logback.version>
<logstash-logback-encoder.version>7.0.1</logstash-logback-encoder.version>
<junit.version>5.8.2</junit.version>
<encoding>UTF-8</encoding>

Expand Down Expand Up @@ -77,12 +76,6 @@
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>${logstash-logback-encoder.version}</version>
<scope>provided</scope>
</dependency>

<!-- test dependencies -->
<dependency>
Expand Down
87 changes: 0 additions & 87 deletions project-without-logstash/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class ExpectedLoggerName implements LogEventMatcher {
private final Pattern expectedName;
private final String inputRegex;

ExpectedLoggerName(String loggerNameRegex) {
private ExpectedLoggerName(String loggerNameRegex) {
inputRegex = loggerNameRegex;
expectedName = Pattern.compile(".*" + loggerNameRegex + ".*");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public final class ExpectedMarker implements LogEventMatcher {
private final String expectedName;

ExpectedMarker(String expectedName) {
private ExpectedMarker(String expectedName) {
this.expectedName = expectedName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

import static java.lang.String.format;
import static java.lang.System.lineSeparator;
import static lombok.AccessLevel.PRIVATE;

/**
* define expected MDC entries with this
*/
@RequiredArgsConstructor
@RequiredArgsConstructor(access = PRIVATE)
public final class ExpectedMdcEntry implements LogEventMatcher {

private final String key;
Expand Down
Loading

0 comments on commit 01eebbe

Please sign in to comment.