Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d1096b6

Browse files
adding logging note to README
1 parent c62433a commit d1096b6

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

‎README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![](https://img.shields.io/github/discussions/CJCrafter/ChatGPT-Java-API)](https://github.com/CJCrafter/ChatGPT-Java-API/discussions)
88
[![License](https://img.shields.io/github/license/CJCrafter/ChatGPT-Java-API)](https://github.com/CJCrafter/ChatGPT-Java-API/blob/master/LICENSE)
99

10-
A community-maintained easy-to-use Java/Kotlin OpenAI API for ChatGPT, Text Completions, and more!
10+
An unofficial, easy-to-use Java/Kotlin OpenAI API for ChatGPT, Text Completions, and more!
1111
</div>
1212

1313
## Features
@@ -96,6 +96,34 @@ For more examples, check out [examples](https://github.com/CJCrafter/ChatGPT-Jav
9696
> **Note**: OpenAI recommends using environment variables for your API token
9797
([Read more](https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety)).
9898

99+
## Logging
100+
We use [SLF4J](http://www.slf4j.org/) for logging. To enable logging, add a logging implementation to your project.
101+
If you encounter an issue with the JSON parsing, we will ask that you enable logging and send us the logs.
102+
103+
Adding a logging implementation:
104+
```kotlin
105+
implementation("ch.qos.logback:logback-classic:$version")
106+
```
107+
108+
Add a `logback.xml` file to your resources folder:
109+
```xml
110+
<configuration>
111+
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
112+
<file>debug.log</file>
113+
<append>false</append>
114+
<encoder>
115+
<pattern>%date %level [%thread] %logger{10} %msg%n</pattern>
116+
</encoder>
117+
</appender>
118+
119+
<logger name="com.cjcrafter.openai" level="DEBUG"/> <!-- Change to OFF to disable our logging -->
120+
121+
<root level="DEBUG">
122+
<appender-ref ref="FILE"/>
123+
</root>
124+
</configuration>
125+
```
126+
99127
## Support
100128
If I have saved you time, please consider [sponsoring me](https://github.com/sponsors/CJCrafter).
101129

‎build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask
22

33
group = "com.cjcrafter"
4-
version = "2.0.0"
4+
version = "2.0.1"
55

66
plugins {
77
`java-library`
88
`maven-publish`
99
signing
1010
id("io.codearte.nexus-staging") version "0.30.0"
11-
kotlin("jvm") version "1.7.20-RC"
11+
kotlin("jvm") version "1.9.20"
1212
id("org.jetbrains.dokka") version "1.8.10" // KDoc Documentation Builder
1313
id("com.github.breadmoirai.github-release") version "2.4.1"
1414
}
@@ -18,7 +18,7 @@ repositories {
1818
}
1919

2020
dependencies {
21-
implementation("com.squareup.okhttp3:okhttp:4.9.2")
21+
implementation("com.squareup.okhttp3:okhttp:4.12.0")
2222

2323
implementation("com.fasterxml.jackson.core:jackson-core:2.15.3")
2424
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.3")
@@ -31,8 +31,8 @@ dependencies {
3131

3232
testImplementation("io.github.cdimascio:dotenv-kotlin:6.4.1")
3333
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
34-
testImplementation("com.squareup.okhttp3:okhttp:4.9.2")
35-
testImplementation("com.squareup.okhttp3:mockwebserver:4.9.2")
34+
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
35+
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
3636
}
3737

3838
kotlin {

‎examples/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
`java-library`
3-
kotlin("jvm") version "1.7.20-RC"
3+
kotlin("jvm") version "1.9.20"
44
}
55

66
repositories {
@@ -9,7 +9,7 @@ repositories {
99

1010
dependencies {
1111
implementation(project(":"))
12-
implementation("com.squareup.okhttp3:okhttp:4.9.2")
12+
implementation("com.squareup.okhttp3:okhttp:4.12.0")
1313
implementation("com.fasterxml.jackson.core:jackson-core:2.15.3")
1414
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.3")
1515
implementation("io.github.cdimascio:dotenv-kotlin:6.4.1")

‎examples/src/main/resources/logback.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
</encoder>
88
</appender>
99

10+
<logger name="com.cjcrafter.openai" level="DEBUG"/>
11+
1012
<root level="DEBUG">
1113
<appender-ref ref="FILE"/>
1214
</root>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /