Skip to content

Commit 068e896

Browse files
committed
Update README.md
Signed-off-by: Dmitry Sulman <[email protected]>
1 parent 015e666 commit 068e896

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,27 @@ This library serves as a bridge between the Reactor Netty HTTP logging mechanism
3131
## Usage
3232

3333
### Adding dependency
34+
3435
#### Maven
36+
3537
```
3638
<dependency>
3739
<groupId>io.github.dmitrysulman</groupId>
3840
<artifactId>logback-access-reactor-netty</artifactId>
3941
<version>1.0.1</version>
4042
</dependency>
4143
```
44+
4245
#### Gradle
46+
4347
```
4448
implementation("io.github.dmitrysulman:logback-access-reactor-netty:1.0.1")
4549
```
4650

4751
### Basic Setup
52+
53+
#### Java
54+
4855
```java
4956
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory();
5057
HttpServer.create()
@@ -54,6 +61,17 @@ HttpServer.create()
5461
.block();
5562
```
5663

64+
#### Kotlin
65+
66+
```kotlin
67+
val factory = ReactorNettyAccessLogFactory()
68+
HttpServer.create()
69+
.enableLogbackAccess(factory)
70+
.bindNow()
71+
.onDispose()
72+
.block()
73+
```
74+
5775
### Configuration
5876

5977
The library can be configured in several ways:
@@ -63,18 +81,18 @@ The library can be configured in several ways:
6381
3. **Programmatic configuration.** Provide configuration file filename or URL of the resource directly:
6482
```java
6583
// Using specific configuration file by the filename
66-
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory("/path/to/logback-access.xml");
84+
var factory = new ReactorNettyAccessLogFactory("/path/to/logback-access.xml");
6785

6886
// Using specific configuration file as a classpath resource
69-
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory(
87+
var factory = new ReactorNettyAccessLogFactory(
7088
this.getClass().getClassLoader().getResource("custom-logback-access.xml")
7189
);
72-
73-
// Enable debug mode
74-
ReactorNettyAccessLogFactory factory = new ReactorNettyAccessLogFactory("logback-access.xml", new JoranConfigurator(), true);
7590
```
7691

7792
### Spring Boot configuration
93+
94+
#### Java
95+
7896
```java
7997
@Configuration
8098
public class NettyAccessLogConfiguration {
@@ -86,6 +104,23 @@ public class NettyAccessLogConfiguration {
86104
}
87105
```
88106

107+
#### Kotlin
108+
109+
```kotlin
110+
@Configuration
111+
class NettyAccessLogConfiguration {
112+
@Bean
113+
fun accessLogNettyServerCustomizer() =
114+
NettyServerCustomizer { server ->
115+
server.enableLogbackAccess(ReactorNettyAccessLogFactory("path/to/your/logback-access.xml"))
116+
}
117+
}
118+
```
119+
120+
## Documentation
121+
122+
- [Java API (Javadoc)](https://javadoc.io/doc/io.github.dmitrysulman/logback-access-reactor-netty/latest/index.html)
123+
- [Kotlin API (KDoc)](https://dmitrysulman.github.io/logback-access-reactor-netty/)
89124

90125
## Author
91126

0 commit comments

Comments
 (0)