mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-11 08:46:59 +02:00
Add a new log level: SQL.
This sits between NOTICE and INFO, allowing to have a complete log of the SQL queries sent to the server while avoiding the very verbose trafic of the DEBUG log level. See #498.
This commit is contained in:
parent
4931604361
commit
381ba18b50
@ -126,7 +126,7 @@
|
|||||||
|
|
||||||
(defmethod query ((pgconn pgsql-connection) sql &key)
|
(defmethod query ((pgconn pgsql-connection) sql &key)
|
||||||
(let ((pomo:*database* (conn-handle pgconn)))
|
(let ((pomo:*database* (conn-handle pgconn)))
|
||||||
(log-message :debug "~a" sql)
|
(log-message :sql "~a" sql)
|
||||||
(pomo:query sql)))
|
(pomo:query sql)))
|
||||||
|
|
||||||
(defmacro handling-pgsql-notices (&body forms)
|
(defmacro handling-pgsql-notices (&body forms)
|
||||||
@ -254,7 +254,7 @@
|
|||||||
|
|
||||||
(loop :for sql :in (alexandria::ensure-list sql)
|
(loop :for sql :in (alexandria::ensure-list sql)
|
||||||
:do (progn
|
:do (progn
|
||||||
(log-message :notice "~a" sql)
|
(log-message :sql "~a" sql)
|
||||||
(pomo:execute sql)))
|
(pomo:execute sql)))
|
||||||
|
|
||||||
(when client-min-messages
|
(when client-min-messages
|
||||||
|
@ -34,12 +34,13 @@
|
|||||||
|
|
||||||
(defmethod query ((msconn mssql-connection) sql &key)
|
(defmethod query ((msconn mssql-connection) sql &key)
|
||||||
"Send SQL query to MSCONN connection."
|
"Send SQL query to MSCONN connection."
|
||||||
|
(log-message :sql "MSSQL: sending query: ~a" query)
|
||||||
(mssql:query sql :connection (conn-handle msconn)))
|
(mssql:query sql :connection (conn-handle msconn)))
|
||||||
|
|
||||||
(defun mssql-query (query)
|
(defun mssql-query (query)
|
||||||
"Execute given QUERY within the current *connection*, and set proper
|
"Execute given QUERY within the current *connection*, and set proper
|
||||||
defaults for pgloader."
|
defaults for pgloader."
|
||||||
(log-message :debug "MSSQL: sending query: ~a" query)
|
(log-message :sql "MSSQL: sending query: ~a" query)
|
||||||
(mssql:query query :connection (conn-handle *mssql-db*)))
|
(mssql:query query :connection (conn-handle *mssql-db*)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
(defun mysql-query (query &key row-fn (as-text t) (result-type 'list))
|
(defun mysql-query (query &key row-fn (as-text t) (result-type 'list))
|
||||||
"Execute given QUERY within the current *connection*, and set proper
|
"Execute given QUERY within the current *connection*, and set proper
|
||||||
defaults for pgloader."
|
defaults for pgloader."
|
||||||
(log-message :debug "MySQL: sending query: ~a" query)
|
(log-message :sql "MySQL: sending query: ~a" query)
|
||||||
(qmynd:mysql-query (conn-handle *connection*) query
|
(qmynd:mysql-query (conn-handle *connection*) query
|
||||||
:row-fn row-fn
|
:row-fn row-fn
|
||||||
:as-text as-text
|
:as-text as-text
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
(change-class (call-next-method slconn) 'sqlite-connection))
|
(change-class (call-next-method slconn) 'sqlite-connection))
|
||||||
|
|
||||||
(defmethod query ((slconn sqlite-connection) sql &key)
|
(defmethod query ((slconn sqlite-connection) sql &key)
|
||||||
|
(log-message :sql "SQLite: sending query: ~a" sql)
|
||||||
(sqlite:execute-to-list (conn-handle slconn) sql))
|
(sqlite:execute-to-list (conn-handle slconn) sql))
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
(defcategory :error (or :error :log))
|
(defcategory :error (or :error :log))
|
||||||
(defcategory :warning (or :warning :error))
|
(defcategory :warning (or :warning :error))
|
||||||
(defcategory :notice (or :notice :warning))
|
(defcategory :notice (or :notice :warning))
|
||||||
(defcategory :info (or :info :notice))
|
(defcategory :sql (or :sql :notice))
|
||||||
(defcategory :debug (or :debug :info))
|
(defcategory :info (or :info :sql))
|
||||||
|
(defcategory :debug (or :debug :sql))
|
||||||
(defcategory :data (or :data :debug))
|
(defcategory :data (or :data :debug))
|
||||||
|
|
||||||
(defvar *log-messengers* nil
|
(defvar *log-messengers* nil
|
||||||
|
Loading…
Reference in New Issue
Block a user