Skip to content

Commit

Permalink
Improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanRenteM committed Apr 29, 2022
1 parent cf3c208 commit ee4dbf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"log"
"path/filepath"
"strings"
Expand Down Expand Up @@ -65,7 +66,7 @@ func initConfig() {
if err := viper.ReadInConfig(); err != nil {
log.Fatal(err)
} else {
log.Printf("Using config file: " + viper.ConfigFileUsed())
fmt.Println("Config file: " + viper.ConfigFileUsed())
}
} else {
// if --config is not passed, adds multiple locations to search for config file
Expand All @@ -77,7 +78,7 @@ func initConfig() {
if err := viper.ReadInConfig(); err != nil {
log.Fatal(err)
} else {
log.Printf("\033[1;34m%s\033[0m", "Using config file: "+viper.ConfigFileUsed())
fmt.Println("Config file: " + viper.ConfigFileUsed())
}
}
}
2 changes: 2 additions & 0 deletions internal/data/mssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package data

import (
"database/sql"
"fmt"

_ "github.com/denisenkom/go-mssqldb"
"github.com/spf13/viper"
)

func getConnection() (*sql.DB, error) {
conn := viper.GetString("connection_string")
fmt.Printf("Connection: %v\n", conn)
return sql.Open("mssql", conn)
}

0 comments on commit ee4dbf6

Please sign in to comment.