chrimaeon / logtag-kapt

This is an annotation processor that will generate an appropriate log tag for Android Log messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Log TAG Annotation Processor Build & Test codecov

License MavenCentral

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

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

plugins {
    id("com.google.devtools.ksp") version "1.1.0"
}
using KAPT

Add the processor and annotation libraries to the projects dependencies

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

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:

@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 <Classname>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<Composable function name> with a companion object property LOG_TAG

License

Copyright (c) 2021. Christian Grach <christian.grach@cmgapps.com>

Licensed 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 at

     http://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.

About

This is an annotation processor that will generate an appropriate log tag for Android Log messages.

License:Apache License 2.0


Languages

Language:Kotlin 97.6%Language:Java 2.0%Language:Shell 0.3%