Skip to content

Commit f2532e0

Browse files
authored
Merge pull request #17 from TinaTiel/topic-replace-sout-with-logging
Topic replace sout with logging (#7)
2 parents 6c2f580 + 4c4ee82 commit f2532e0

17 files changed

+942
-755
lines changed

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Filesystem Stuff
2+
**.DS_Store
3+
4+
# Maven output directory
5+
**/target
6+
7+
### Maven Plugins ###
8+
.flattened-pom.xml
9+
10+
### Intellij ###
11+
**/.idea
12+
**/*.iml
13+
14+
### react ###
15+
.DS_*
16+
*.log
17+
**logs
18+
**/*.backup.*
19+
**/*.back.*
20+
21+
**node_modules
22+
**bower_components
23+
24+
*.sublime*

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you don't want your program to wait for a connection you could alternatively
3131
```java
3232
controller.registerConnectCallback(response -> {
3333
GetVersionResponse version = (GetVersionResponse) response;
34-
System.out.println(version.getObsStudioVersion());
34+
log.debug(version.getObsStudioVersion());
3535

3636
// Other requests...
3737
});
@@ -47,7 +47,7 @@ OBSRemoteController controller = new OBSRemoteController("ws://localhost:4444",
4747
Catch any authentication errors by registering a callback for this:
4848
```java
4949
controller.registerConnectionFailedCallback(message -> {
50-
System.err.println("Failed to connect: " + message);
50+
log.error("Failed to connect: " + message);
5151
})
5252
```
5353

@@ -66,6 +66,36 @@ A description of every request and event can be found in the plugin's [**Protoco
6666
Examples can be found [**here**](src/test/java/net/twasi/obsremotejava/test/OBSRemoteControllerTest.java). Just uncomment the requests you want to test or copy.
6767

6868
---
69+
70+
## Logging
71+
This project ships with SLF4J, and uses the SLF4J-Simple binding by default so logs are printed directly to the console.
72+
73+
If you wish to override this, for example with Logback, you must exclude SLF4J in your POM and add the dependency to the
74+
binding you want (depends on the vendor)
75+
```
76+
<dependencies>
77+
<dependency>
78+
<groupId>net.twasi</groupId>
79+
<artifactId>obs-websocket-java</artifactId>
80+
<version>1.0.6-tinatiel-1-0-0</version>
81+
<!-- Exclude the default logging implementation -->
82+
<exclusions>
83+
<exclusion>
84+
<groupId>org.slf4j</groupId>
85+
<artifactId>slf4j-simple</artifactId>
86+
</exclusion>
87+
</exclusions>
88+
</dependency>
89+
90+
<!-- Add your desired logging implementation -->
91+
<dependency>
92+
<groupId>ch.qos.logback</groupId>
93+
<artifactId>logback-classic</artifactId>
94+
<version>1.1.7</version>
95+
</dependency>
96+
</dependencies>
97+
```
98+
6999
## Contribution
70100

71101
If you miss an endpoint feel free to make a pull request. Any help is appreciated.

pom.xml

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<name>obs-websocket-java</name>
77
<groupId>net.twasi</groupId>
88
<artifactId>obs-websocket-java</artifactId>
9-
<version>1.0.6-snapshot</version>
9+
<version>1.0.7</version>
1010

1111
<description>Library to connect to the OBS WebSocket interface.</description>
1212
<url>https://github.com/Twasi/obs-websocket-java</url>
@@ -36,14 +36,37 @@
3636
<tag>HEAD</tag>
3737
</scm>
3838

39+
<properties>
40+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
41+
<java.version>8</java.version>
42+
<slf4j.version>1.7.30</slf4j.version>
43+
<junit.version>5.0.0</junit.version>
44+
</properties>
3945
<build>
4046
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-surefire-plugin</artifactId>
50+
<version>2.22.2</version>
51+
<configuration>
52+
<excludes>
53+
54+
<exclude>**/*IT.java</exclude>
55+
</excludes>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-failsafe-plugin</artifactId>
61+
<version>2.22.2</version>
62+
</plugin>
4163
<plugin>
4264
<groupId>org.apache.maven.plugins</groupId>
4365
<artifactId>maven-compiler-plugin</artifactId>
66+
<version>3.8.1</version>
4467
<configuration>
45-
<source>8</source>
46-
<target>8</target>
68+
<source>${java.version}</source>
69+
<target>${java.version}</target>
4770
</configuration>
4871
</plugin>
4972
<plugin>
@@ -164,21 +187,50 @@
164187
</distributionManagement>
165188

166189
<dependencies>
190+
<!-- Bot dependencies -->
167191
<dependency>
168192
<groupId>org.eclipse.jetty.websocket</groupId>
169193
<artifactId>websocket-client</artifactId>
170194
<version>9.4.8.v20171121</version>
171195
</dependency>
196+
<dependency>
197+
<groupId>com.google.code.gson</groupId>
198+
<artifactId>gson</artifactId>
199+
<version>2.8.2</version>
200+
</dependency>
201+
202+
<!-- Logging dependencies -->
203+
<dependency>
204+
<groupId>org.slf4j</groupId>
205+
<artifactId>slf4j-api</artifactId>
206+
<version>${slf4j.version}</version>
207+
</dependency>
208+
<dependency>
209+
<groupId>org.slf4j</groupId>
210+
<artifactId>slf4j-simple</artifactId>
211+
<version>${slf4j.version}</version>
212+
</dependency>
213+
214+
<!-- Test dependencies -->
172215
<dependency>
173216
<groupId>org.junit.jupiter</groupId>
174217
<artifactId>junit-jupiter-api</artifactId>
175-
<version>5.0.0</version>
218+
<version>${junit.version}</version>
219+
<scope>test</scope>
176220
</dependency>
177221
<dependency>
178-
<groupId>com.google.code.gson</groupId>
179-
<artifactId>gson</artifactId>
180-
<version>2.8.2</version>
222+
<groupId>org.junit.jupiter</groupId>
223+
<artifactId>junit-jupiter-engine</artifactId>
224+
<version>${junit.version}</version>
225+
<scope>test</scope>
181226
</dependency>
227+
<dependency>
228+
<groupId>org.assertj</groupId>
229+
<artifactId>assertj-core</artifactId>
230+
<version>3.18.1</version>
231+
<scope>test</scope>
232+
</dependency>
233+
182234
</dependencies>
183235

184236
</project>

0 commit comments

Comments
 (0)