mirror of
https://github.com/danbulant/sql2csv
synced 2026-05-19 04:18:33 +00:00
Colors option
This commit is contained in:
parent
b57793b58a
commit
1fa2ba1fc4
1 changed files with 11 additions and 5 deletions
16
sql2csv.js
16
sql2csv.js
|
|
@ -3,14 +3,20 @@ const { execSync } = require('child_process');
|
|||
class sql2csv {
|
||||
log(str){
|
||||
if(!this.options.logging) return;
|
||||
if(this.options.colors)
|
||||
console.log(this.options.prefix + str + "\x1b[0m");
|
||||
console.log(this.options.prefix + str + "\x1b[0m");
|
||||
if(this.options.colors){
|
||||
console.log(this.options.prefix + str + "\x1b[0m");
|
||||
} else {
|
||||
console.log(this.options.prefix + str);
|
||||
}
|
||||
}
|
||||
|
||||
warn(str){
|
||||
if(!this.options.logging) return;
|
||||
console.warn(this.options.prefix + "\x1b[33m" + str + "\x1b[0m");
|
||||
if(this.options.colors){
|
||||
console.warn(this.options.prefix + "\x1b[33m" + str + "\x1b[0m");
|
||||
} else {
|
||||
console.warn(this.options.prefix + str);
|
||||
}
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
|
@ -48,7 +54,7 @@ class sql2csv {
|
|||
setOptions(options){
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
|
||||
//set connection
|
||||
setConnection(conn){
|
||||
this.conn = conn;
|
||||
|
|
|
|||
Loading…
Reference in a new issue