Skip to content

Commit

Permalink
#26 try out slf4j api instead of JUL
Browse files Browse the repository at this point in the history
  • Loading branch information
kdabir committed Nov 20, 2018
1 parent 4862464 commit a0d01a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ repositories {
dependencies {
compileOnly 'org.codehaus.groovy:groovy-all:2.5.4'
compile 'org.hsqldb:hsqldb:2.4.1'
compile 'org.slf4j:slf4j-api:1.7.9'
testCompile 'junit:junit:4.12'
testCompile 'io.github.kdabir.directree:directree:0.3.0'
}
Expand Down
8 changes: 4 additions & 4 deletions src/gstorm/Gstorm.groovy
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package gstorm

import groovy.sql.Sql
import groovy.util.logging.Log
import groovy.util.logging.Slf4j
import gstorm.builders.CreateTableQueryBuilder
import gstorm.helpers.SqlObjectFactory
import gstorm.metadata.ClassMetaData

import java.sql.Connection
import java.util.logging.Level

@Log
@Slf4j
class Gstorm {
Sql sql

Expand Down Expand Up @@ -69,11 +69,11 @@ class Gstorm {
return this
}

def enableQueryLogging(level = Level.FINE) {
def enableQueryLogging() {
def sqlMetaClass = Sql.class.metaClass

sqlMetaClass.invokeMethod = { String name, args ->
if (args) log.log(level, args.first()) // so far the first arg has been the query.
if (args) log.info(args.first()) // so far the first arg has been the query.
sqlMetaClass.getMetaMethod(name, args).invoke(delegate, args)
}
}
Expand Down

0 comments on commit a0d01a0

Please sign in to comment.