@@ -56,7 +56,7 @@ func NewDbqCliApp(dbqConfigPath string) DbqCliApp {
5656func (app * DbqAppImpl ) PingDataSource (srcId string ) (string , error ) {
5757 var dataSource = app .FindDataSourceById (srcId )
5858
59- cnn , err := getDbqConnector (* dataSource )
59+ cnn , err := getDbqConnector (* dataSource , app . logLevel )
6060 if err != nil {
6161 return "" , err
6262 }
@@ -72,7 +72,7 @@ func (app *DbqAppImpl) PingDataSource(srcId string) (string, error) {
7272func (app * DbqAppImpl ) ImportDatasets (srcId string , filter string ) ([]string , error ) {
7373 var dataSource = app .FindDataSourceById (srcId )
7474
75- cnn , err := getDbqConnector (* dataSource )
75+ cnn , err := getDbqConnector (* dataSource , app . logLevel )
7676 if err != nil {
7777 return []string {}, err
7878 }
@@ -83,7 +83,7 @@ func (app *DbqAppImpl) ImportDatasets(srcId string, filter string) ([]string, er
8383func (app * DbqAppImpl ) ProfileDataset (srcId string , dataset string , sample bool ) (* dbqcore.TableMetrics , error ) {
8484 var dataSource = app .FindDataSourceById (srcId )
8585
86- cnn , err := getDbqConnector (* dataSource )
86+ cnn , err := getDbqConnector (* dataSource , app . logLevel )
8787 if err != nil {
8888 return nil , err
8989 }
@@ -119,7 +119,7 @@ func (app *DbqAppImpl) FindDataSourceById(srcId string) *dbqcore.DataSource {
119119}
120120
121121func (app * DbqAppImpl ) RunCheck (check * dbqcore.Check , dataSource * dbqcore.DataSource , dataset string , defaultWhere string ) (bool , string , error ) {
122- cnn , err := getDbqConnector (* dataSource )
122+ cnn , err := getDbqConnector (* dataSource , app . logLevel )
123123 if err != nil {
124124 return false , "" , err
125125 }
@@ -156,11 +156,12 @@ func initConfig(dbqConfigPath string) (*dbqcore.DbqConfig, string) {
156156 return & dbqConfig , v .ConfigFileUsed ()
157157}
158158
159- func getDbqConnector (ds dbqcore.DataSource ) (dbqcore.DbqConnector , error ) {
159+ func getDbqConnector (ds dbqcore.DataSource , logLevel slog. Level ) (dbqcore.DbqConnector , error ) {
160160 dsType := strings .ToLower (ds .Type )
161+ logHandler := slog .NewTextHandler (os .Stdout , & slog.HandlerOptions {Level : logLevel })
161162 switch dsType {
162163 case "clickhouse" :
163- return dbqcore .NewClickhouseDbqConnector (ds )
164+ return dbqcore .NewClickhouseDbqConnector (ds , slog . New ( logHandler ) )
164165 default :
165166 return nil , fmt .Errorf ("data source type '%s' is not supported" , dsType )
166167 }
0 commit comments