-
I met several log issues when i do develop use lucky, in fact, i asked one question before in discuss, check #1784, but that did not clear my doubts, instead, more questions. Following clover project is a tiny project which almost follow the document based on lucky 1.0 https://github.com/zw963/clover All following issue is reproducible on this project, on the konsole terminal in Arch linux.
DB::Log.level = :info
Avram::QueryLog.dexter.configure(:info) So, Is i do somethings wrong, or document is wrong?
Check following screenshot. I suppose
But, when i revert the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
No, this is not meant to be clickable since that's not a cross platform compatible action for standard terminals.
There's 2 places where logging happens currently. In Avram itself through an event emitter https://github.com/luckyframework/avram/blob/376379a54ca115395e1b7eaf2afeeef86720d469/src/avram.cr#L38-L56 and then also at the CrystalDB level https://github.com/crystal-lang/crystal-db/blob/87dc8aafaf1fe5acc2c2203ea7610d0949bda207/src/db/statement.cr#L145 This is where you're seeing the "Executing query" in the red box. Crystal DB doesn't really give us a good way to hook in to the query methods to customize our logging, so we end up having to emit 2 separate logs depending on what your needs are. If you need to silence all logs, be sure to turn off both
|
Beta Was this translation helpful? Give feedback.
-
So, how to show the SQL query log in lucky? Do we need update our document for clarity? |
Beta Was this translation helpful? Give feedback.
-
@jwoertink I had the same issue, but couldn't figure out what was wrong & where, So, to make it work, I have Monkey Patched the module DB
class Statement
protected def emit_log(args : Enumerable)
Log.debug &.emit(command, query: command, args: MetadataValueConverter.arg_to_log(args))
end
end
end The original is protected def emit_log(args : Enumerable)
Log.debug &.emit("Executing query", query: command, args: MetadataValueConverter.arg_to_log(args))
end |
Beta Was this translation helpful? Give feedback.
luckyframework/avram#937