https://github.com/chrimaeon/logtag-kapt
This is an annotation processor that will generate an appropriate log tag for Android Log messages.
https://github.com/chrimaeon/logtag-kapt
android android-library android-log annotation-processor kapt kotlin ksp logging timber
Last synced: 8 days ago
JSON representation
This is an annotation processor that will generate an appropriate log tag for Android Log messages.
- Host: GitHub
- URL: https://github.com/chrimaeon/logtag-kapt
- Owner: chrimaeon
- License: apache-2.0
- Created: 2021-01-04T13:12:41.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T21:45:15.000Z (10 months ago)
- Last Synced: 2025-01-01T22:28:57.494Z (10 months ago)
- Topics: android, android-library, android-log, annotation-processor, kapt, kotlin, ksp, logging, timber
- Language: Kotlin
- Homepage:
- Size: 321 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Log TAG Annotation Processor [](https://github.com/chrimaeon/logtag-kapt/actions/workflows/main.yml) [](https://codecov.io/gh/chrimaeon/logtag-kapt)
[](http://www.apache.org/licenses/LICENSE-2.0)
[](https://repo1.maven.org/maven2/com/cmgapps/logtag/)This is an annotation processor that will generate an appropriate log tag for Android Log messages
## Usage
### Setup
using KSP
The library supports KSP ([Kotlin Symbol Processing API])
Add the processor and annotation libraries to the projects dependencies
```kotlin
dependencies {
implementation("com.cmgapps:log-tag:1.1.0")
ksp("com.cmgapps:log-tag-processor:1.1.0")
}
```also get sure to apply the KSP Gradle Plugin
```kotlin
plugins {
id("com.google.devtools.ksp") version "1.1.0"
}
```using KAPT
Add the processor and annotation libraries to the projects dependencies
```kotlin
dependencies {
implementation("com.cmgapps:log-tag:1.1.0")
kapt("com.cmgapps:log-tag-processor:1.1.0")
}
```also get sure to apply the Annotation Processor Plugin
```kotlin
plugins {
kotlin("kapt")
}
```### Code
In your source file add the `com.cmgapps.LogTag` annotation to the class file you want to have a log tag generated:
```kotlin
@com.cmgapps.LogTag
class SuperImportantClass
```* For **Kotlin** classes this will generate an extension property to you class called `LOG_TAG`
you can then use as the tag for your android log messages.* For **Java** it will generate a class called `LogTag` which has a constant field called `LOG_TAG` you can
then import to tag your android log messages* For **Jetpack Compose** you can annotate the `@Composable` function for the processor to generate a class called
`Composable` with a companion object property `LOG_TAG`## License
```text
Copyright (c) 2021. Christian GrachLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```[Kotlin Symbol Processing API]: https://github.com/google/ksp