Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StatementInterceptor: append id transaction in afterCommit and afterRollback #1530

Closed
SchweinchenFuntik opened this issue Jun 10, 2022 · 0 comments

Comments

@SchweinchenFuntik
Copy link
Contributor

Motivation:
Ability to create structured logs

Current realization

object DebugStatementInterceptor : StatementInterceptor {
 
    override fun beforeRollback(transaction: Transaction) {
        println("before (${transaction.id}): rollback")
    }

    override fun beforeCommit(transaction: Transaction) {
        println("before (${transaction.id}): commit")
    }

    override fun afterCommit() {
        val transaction = TransactionManager.currentOrNull()
        println("InitStatementInterceptor after (${transaction?.id}): commit")
    }

    override fun afterRollback() {
        val transaction = TransactionManager.currentOrNull()
        println("InitStatementInterceptor after (${transaction?.id}): rollback")
    }
}

ideal:

object DebugStatementInterceptor : StatementInterceptor {
 
    override fun beforeRollback(transaction: Transaction) {
        println("before (${transaction.id}): rollback")
    }

    override fun beforeCommit(transaction: Transaction) {
        println("before (${transaction.id}): commit")
    }

    override fun afterCommit(id: String) {
        println("InitStatementInterceptor after ($id): commit")
    }

    override fun afterRollback(id: String) {
        println("InitStatementInterceptor after ($id): rollback")
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants