Skip to content

Commit

Permalink
Move classes to unique packages
Browse files Browse the repository at this point in the history
  • Loading branch information
msdousti committed Apr 3, 2023
1 parent 041862e commit b09224c
Show file tree
Hide file tree
Showing 310 changed files with 1,382 additions and 877 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,9 @@
**Fixed bugs:**

- PrimitiveJsonPropertyBodyFilter regexp is incorrect [\#780](https://github.com/zalando/logbook/issues/780)
- I can not find logs in console using spring boot app, I have just installed `logbook-spring-boot-starter` and add `logging.level.org.zalando.logbook.Logbook=TRACE` to my common.properties file [\#768](https://github.com/zalando/logbook/issues/768)
- I can not find logs in console using spring boot app, I have just installed `logbook-spring-boot-starter` and
add `logging.level.org.zalando.logbook.api.Logbook=TRACE` to my common.properties
file [\#768](https://github.com/zalando/logbook/issues/768)

**Merged pull requests:**

Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,19 +254,19 @@ respectively (in conjunction with `ForwardingHttpRequest`/`ForwardingHttpRespons
You can configure filters like this:

```java
import static org.zalando.logbook.HeaderFilters.authorization;
import static org.zalando.logbook.HeaderFilters.eachHeader;
import static org.zalando.logbook.QueryFilters.accessToken;
import static org.zalando.logbook.QueryFilters.replaceQuery;

Logbook logbook = Logbook.builder()
.requestFilter(RequestFilters.replaceBody(message -> contentType("audio/*").test(message) ? "mmh mmh mmh mmh" : null))
.responseFilter(ResponseFilters.replaceBody(message -> contentType("*/*-stream").test(message) ? "It just keeps going and going..." : null))
.queryFilter(accessToken())
.queryFilter(replaceQuery("password", "<secret>"))
.headerFilter(authorization())
.headerFilter(eachHeader("X-Secret"::equalsIgnoreCase, "<secret>"))
.build();
import static org.zalando.logbook.core.HeaderFilters.authorization;
import static org.zalando.logbook.core.HeaderFilters.eachHeader;
import static org.zalando.logbook.core.QueryFilters.accessToken;
import static org.zalando.logbook.core.QueryFilters.replaceQuery;

Logbook logbook=Logbook.builder()
.requestFilter(RequestFilters.replaceBody(message->contentType("audio/*").test(message)?"mmh mmh mmh mmh":null))
.responseFilter(ResponseFilters.replaceBody(message->contentType("*/*-stream").test(message)?"It just keeps going and going...":null))
.queryFilter(accessToken())
.queryFilter(replaceQuery("password","<secret>"))
.headerFilter(authorization())
.headerFilter(eachHeader("X-Secret"::equalsIgnoreCase,"<secret>"))
.build();
```

You can configure as many filters as you want - they will run consecutively.
Expand Down Expand Up @@ -549,7 +549,8 @@ Logger, Stream and Chunking.

##### Logger

By default, requests and responses are logged with an *slf4j* logger that uses the `org.zalando.logbook.Logbook` category and the log level `trace`. This can be customized:
By default, requests and responses are logged with an *slf4j* logger that uses the `org.zalando.logbook.api.Logbook`
category and the log level `trace`. This can be customized:

```java
Logbook logbook = Logbook.builder()
Expand Down Expand Up @@ -986,7 +987,7 @@ for outputs like
"@timestamp" : "2019-03-08T09:37:46.239+01:00",
"@version" : "1",
"message" : "GET http://localhost/test?limit=1",
"logger_name" : "org.zalando.logbook.Logbook",
"logger_name" : "org.zalando.logbook.api.Logbook",
"thread_name" : "main",
"level" : "TRACE",
"level_value" : 5000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import com.google.gag.annotation.remark.ThisWouldBeOneLineIn;

Expand All @@ -10,7 +10,7 @@
import java.util.function.UnaryOperator;

import static java.util.Collections.singleton;
import static org.zalando.logbook.Fold.fold;
import static org.zalando.logbook.api.Fold.fold;

interface ApplyHttpHeaders extends HttpHeaders {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import lombok.experimental.UtilityClass;

Expand Down Expand Up @@ -58,4 +58,4 @@ Charset parseCharset(@Nullable String contentTypeValue) {
static final String CONTENT_TYPE_HEADER = "Content-Type";
private static final String SEMICOLON = ";";
private static final String CHARSET_PREFIX = "charset=";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

public interface CorrelationId {
String generate(HttpRequest request);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import lombok.AllArgsConstructor;
import lombok.With;
Expand All @@ -15,7 +15,7 @@

import static lombok.AccessLevel.PRIVATE;
import static org.organicdesign.fp.collections.PersistentVector.ofIter;
import static org.zalando.logbook.Fold.fold;
import static org.zalando.logbook.api.Fold.fold;

@SuppressWarnings("deprecation") // needed because of @Delegate and @Deprecated
@AllArgsConstructor(access = PRIVATE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import lombok.experimental.UtilityClass;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
Expand All @@ -13,7 +13,7 @@
import java.util.function.Predicate;
import java.util.function.UnaryOperator;

import static org.zalando.logbook.DefaultHttpHeaders.EMPTY;
import static org.zalando.logbook.api.DefaultHttpHeaders.EMPTY;

/**
* An immutable multi-map representing HTTP headers. It offers three kinds of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import lombok.Singular;
import org.apiguardian.api.API;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand All @@ -9,7 +9,7 @@
import static org.apiguardian.api.API.Status.STABLE;

@API(status = STABLE)
interface LogbookFactory {
public interface LogbookFactory {

LogbookFactory INSTANCE = load(LogbookFactory.class).iterator().next();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import lombok.AllArgsConstructor;
import lombok.Getter;

import javax.annotation.Nullable;

import static lombok.AccessLevel.PACKAGE;
import static org.zalando.logbook.BodyFilter.merge;
import static org.zalando.logbook.api.BodyFilter.merge;

@AllArgsConstructor
@Getter(PACKAGE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import javax.annotation.Nullable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import lombok.experimental.UtilityClass;

Expand All @@ -7,35 +7,35 @@
import java.util.Set;

import static java.util.Arrays.asList;
import static org.zalando.logbook.RequestURI.Component.AUTHORITY;
import static org.zalando.logbook.RequestURI.Component.PATH;
import static org.zalando.logbook.RequestURI.Component.QUERY;
import static org.zalando.logbook.RequestURI.Component.SCHEME;
import static org.zalando.logbook.api.RequestURI.Component.AUTHORITY;
import static org.zalando.logbook.api.RequestURI.Component.PATH;
import static org.zalando.logbook.api.RequestURI.Component.QUERY;
import static org.zalando.logbook.api.RequestURI.Component.SCHEME;

@UtilityClass
final class RequestURI {
public final class RequestURI {

enum Component {
public enum Component {
SCHEME, AUTHORITY, PATH, QUERY
}

static String reconstruct(final HttpRequest request) {
public static String reconstruct(final HttpRequest request) {
final StringBuilder url = new StringBuilder();
reconstruct(request, url);
return url.toString();
}

static void reconstruct(final HttpRequest request, final StringBuilder output) {
public static void reconstruct(final HttpRequest request, final StringBuilder output) {
reconstruct(request, EnumSet.allOf(Component.class), output);
}

static String reconstruct(final HttpRequest request, final Component... components) {
public static String reconstruct(final HttpRequest request, final Component... components) {
final StringBuilder url = new StringBuilder();
reconstruct(request, EnumSet.copyOf(asList(components)), url);
return url.toString();
}

static String reconstruct(final HttpRequest request, final Set<Component> components) {
public static String reconstruct(final HttpRequest request, final Set<Component> components) {
final StringBuilder url = new StringBuilder();
reconstruct(request, components, url);
return url.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import org.apiguardian.api.API;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import static org.zalando.logbook.Fold.fold;
import static org.zalando.logbook.api.Fold.fold;

interface UpdateHttpHeaders extends HttpHeaders {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package org.zalando.logbook.api;

import javax.annotation.ParametersAreNonnullByDefault;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.zalando.logbook;
package org.zalando.logbook.api;

import lombok.AllArgsConstructor;
import org.junit.jupiter.api.Test;
Expand Down
Loading

0 comments on commit b09224c

Please sign in to comment.