Skip to content

Commit d9c318c

Browse files
committed
doc: update README.md
1 parent c7c5c85 commit d9c318c

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
LogUnit
22
=======
33

4+
[![Build Status](https://travis-ci.com/netmikey/logunit.svg?branch=master)](https://travis-ci.com/netmikey/logunit)
45
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.netmikey.logunit/logunit-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.netmikey.logunit/logunit-core)
56

67
A Java library for unit-testing logging.
@@ -10,23 +11,29 @@ A Java library for unit-testing logging.
1011

1112
Sometimes, writing specific information into its log(file) is an important part of an application's functionality. As such, it's probably a good idea to cover that behavior in the application's unit tests.
1213

13-
Although there are other solutions to achieve this (like e.g. using mocks and test for the methods to be called), LogUnit aims at testing on another level: right within the logging framework, so you can still see all your logs while testing. No matter how you generate your log messages in your project, if they end up in the popular [Slf4j](https://www.slf4j.org) library or in java.util.logging, you can use LogUnit (\*).
14+
Although there are other solutions to achieve this (like e.g. using mocks and test for the methods to be called), LogUnit aims at testing on another level: right within the logging framework, so you can still see all your logs while testing. No matter how you generate your log messages in your project, if they end up in one of the supported logging frameworks, you can use LogUnit.
1415

1516

1617
## Requirements
1718

1819
- Java 8 or above
1920
- JUnit 5
20-
- You must be using Slf4j or java.util.logging for logging
21-
- You must be using Logback or java.util.logging as log binding (\*)
21+
- You must be using one of the supported logging frameworks at test runtime
22+
- You may use [Slf4j](https://www.slf4j.org) or your logging framework's native API (or anything else that makes your log events end up in your logging framework at runtime)
23+
24+
### Supported logging frameworks
25+
26+
- java.util.logging (the JDK's logging API)
27+
- [Logback](https://logback.qos.ch)
28+
- [Log4j2](https://logging.apache.org/log4j/2.x/)
2229

2330

2431
## Installation
2532

2633
Add LogUnit to your project's dependencies.
2734

2835
* Declare `logunit-core` as compile-time dependency
29-
* Declare the binding-specific module (e.g. `logunit-logback` or `logunit-jul` (\*)) as test-runtime dependency
36+
* Declare the binding-specific module (e.g. `logunit-logback`, `logunit-log4j2` or `logunit-jul`) as test-runtime dependency
3037

3138
```
3239
dependencies {
@@ -38,6 +45,9 @@ dependencies {
3845
// for Logback:
3946
// testRuntimeOnly("io.github.netmikey.logunit:logunit-logback:1.1.0")
4047
48+
// for Log4j2:
49+
// testRuntimeOnly("io.github.netmikey.logunit:logunit-log4j2:1.1.0")
50+
4151
// for JUL:
4252
// testRuntimeOnly("io.github.netmikey.logunit:logunit-jul:1.1.0")
4353
}
@@ -97,11 +107,7 @@ See [LogCapturerWithLogbackTest.java](https://github.com/netmikey/logunit/blob/m
97107

98108
## Architecture
99109

100-
LogUnit wants to remain as transparent as possible. That means your unit tests' logs should stay the way they are (or at least as close as possible). As such, we don't want to bring and force our own Slf4j binding implementation onto consuming projects.
101-
102-
Therefor, LogUnit's architecture is similar to Slf4j's: At it's core, it uses the Slf4j API but in order to work at runtime, it provides binding-specific modules for hooking into the most popular logging frameworks (\*).
103-
110+
LogUnit wants to remain as transparent and easy to setup as possible. That means your unit tests' logs should stay the way they are (or at least as close as possible). As such, we don't want to bring and force our own Slf4j binding implementation onto consuming projects.
104111

105-
## Limitations
112+
Therefor, LogUnit's architecture is similar to Slf4j's: At it's core, it uses the Slf4j API but in order to work at runtime, it provides binding-specific modules for hooking into the most popular logging frameworks.
106113

107-
(\*) Currently, only Logback and java.util.logging are supported.

0 commit comments

Comments
 (0)