Details
-
New Feature
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
see https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/157
Implement custom logging (log commands, trace, ...) would be a great addition.
There is different logger library like winston, debug, loglevel, ...
Driver must not required any of those logger as dependency, but provide API to permit using those, like :
const myLogger = { |
trace(msg) {
|
console.log(`${new Date().toLocaleString()} ${msg} |
},
|
debug(msg) {
|
console.log(`${new Date().toLocaleString()} ${msg} |
},
|
error(msg) {
|
console.log(`ERROR: ${new Date().toLocaleString()} ${msg} |
},
|
}
|
const conn = await mariadb.createConnection({ |
host: "192.168.1.1", |
user: "user", |
password: "password", |
logger: {
|
network: myLogger.trace // log all network exchanges |
query: myLogger.debug // the raw sql of all sql queries |
error: myLogger.error // all errors |
}
|
});
|
|