-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
384 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,45 @@ | ||
# Contributing | ||
|
||
## Commit messages | ||
|
||
Before writing a commit message read [this article](https://chris.beams.io/posts/git-commit/). | ||
|
||
## Build | ||
|
||
Before pushing any changes make sure project builds without errors with: | ||
|
||
``` | ||
./gradlew build | ||
``` | ||
|
||
## Unit tests | ||
|
||
This project uses [Kotest](https://kotest.io/) for testing. | ||
|
||
- please use the `Spec` suffix for new test classes | ||
- make sure tests clearly document new feature | ||
|
||
## Validate changes locally | ||
|
||
Before submitting a pull request test your changes locally on a sample project. | ||
There are few ways for local testing: | ||
|
||
- simply use one of the [sample subprojects](https://github.com/coditory/klog/tree/master/samples) | ||
- or publish library to maven local repository with `./gradlew publishToMavenLocal` and use it in any project | ||
via [`mavenLocal()`](https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:maven_local) repository | ||
|
||
## Documentation | ||
## Validating with snapshot release | ||
Snapshot release is triggered automatically after merge to the main branch. | ||
To use a released snapshot version make sure to register Sonatype snapshot repository in gradle with: | ||
|
||
``` | ||
// build.gradle.kts | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
url = URI("https://oss.sonatype.org/content/repositories/snapshots") | ||
} | ||
} | ||
``` | ||
|
||
The snapshot version can be found in GitHub Action build log. | ||
|
||
## Documentation | ||
If change adds new feature or modifies a new one | ||
update [documentation](https://github.com/coditory/klog/tree/master/samples). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Labeler | ||
|
||
on: [pull_request_target] | ||
|
||
jobs: | ||
labeler: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: actions/labeler@v4 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
klog/src/main/kotlin/com/coditory/klog/text/json/JsonExceptionFormatter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.coditory.klog.text.json | ||
|
||
import com.coditory.klog.text.plain.PlainTextExceptionFormatter | ||
|
||
fun interface JsonExceptionFormatter { | ||
fun format( | ||
throwable: Throwable, | ||
appendable: Appendable, | ||
) | ||
|
||
companion object { | ||
fun from( | ||
formatter: PlainTextExceptionFormatter, | ||
escape: Boolean = true, | ||
): JsonExceptionFormatter { | ||
return JsonExceptionFormatter { throwable, appendable -> | ||
appendable.append('"') | ||
val wrapped = if (escape) JsonEscapedAppendable(appendable) else appendable | ||
formatter.format(throwable, wrapped) | ||
appendable.append('"') | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.