Kora фреймворк для написания Java / Kotlin приложений с упором на производительность, эффективность, прозрачность сделанный разработчиками Т-Банк / Тинькофф

Kora is a framework for writing Java / Kotlin applications with a focus on performance, efficiency, transparency made by T-Bank / Tinkoff developers

Skip to content

Logging

Module for declarative logging of method arguments and result using annotations.

Dependency

Most likely already transitively connected from other dependencies or from Logback, otherwise it needs to be added:

Dependency build.gradle:

implementation "ru.tinkoff.kora:logging-common"

Module:

@KoraApp
public interface Application extends LoggingModule { }

Dependency build.gradle.kts:

implementation("ru.tinkoff.kora:logging-common")

Module:

@KoraApp
interface Application : LoggingModule

Logging

It is expected to use special combinations of annotations to customize method logging.

Argument

@Log.in
public String methodWithReturnAndOnlyLogArgs(@Log.off String strParam,int numParam) {
    return"testResult";
}
Logging Level Logging
TRACE, DEBUG

DEBUG [] r.t.e.e.Example.methodWithArgs: > {data: {numParam: "4"}}

INFO

INFO [] r.t.e.e.Example.methodWithArgs: >

Result

@Log.out
public String methodWithOnlyLogReturnAndArgs(String strParam, int numParam) {
    return "testResult"
}
Logging level Logging
TRACE, DEBUG

DEBUG [] r.t.e.e.Example.methodWithArgs: < {data: {out: "testResult"}}

INFO

INFO [] r.t.e.e.Example.methodWithArgs: <

Argument and result

@Log
public String methodWithArgs(String strParam, int numParam) {
    return "testResult";
}
Logging Level Logging
TRACE, DEBUG

DEBUG [] r.t.e.e.Example.methodWithArgs: > {data: {strParam: "s", numParam: "4"}}

DEBUG [] r.t.e.e.Example.methodWithArgs: < {data: {out: "testResult"}}

INFO

INFO [] r.t.e.e.Example.methodWithArgs: >

INFO [] r.t.e.e.Example.methodWithArgs: <

Selective logging

@Log.out
@Log.off
public String methodWithOnlyLogReturnAndArgs(String strParam,int numParam) {
    return"testResult";
}
Logging Level Logging
TRACE, DEBUG

INFO [] r.t.e.e.Example.methodWithArgs: <

INFO

INFO [] r.t.e.e.Example.methodWithArgs: <

Signatures

Available signatures for repository methods out of the box:

Class must be non final in order for aspects to work.

The T refers to the type of the return value, either Void.

Class must be open in order for aspects to work.

By T we mean the type of the return value, either T?, either Unit.