Skip to content

Commit

Permalink
Improve logging output for database connections
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Oct 8, 2017
1 parent a873c21 commit c18719a
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion sync/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ func (database *Database) String(direction string) string {

// remote
remote = append(remote, fmt.Sprintf("Schema:%s", database.Schema))
remote = append(remote, fmt.Sprintf("Connection:%s", database.Connection.GetType()))

if database.Hostname != "" {
if database.Connection.SshConnectionHostnameString() != "" {
remote = append(remote, fmt.Sprintf("SSH:%s", database.Connection.SshConnectionHostnameString()))
}

if database.Connection.Docker != "" {
remote = append(remote, fmt.Sprintf("Docker:%s", database.Connection.Docker))
} else if database.Hostname != "" {
hostname := database.Hostname

if database.Port != "" {
Expand All @@ -69,6 +76,22 @@ func (database *Database) String(direction string) string {

// local
local = append(local, fmt.Sprintf("Schema:%s", database.Local.Schema))
local = append(local, fmt.Sprintf("Connection:%s", database.Local.Connection.GetType()))

if database.Local.Connection.SshConnectionHostnameString() != "" {
local = append(local, fmt.Sprintf("SSH:%s", database.Local.Connection.SshConnectionHostnameString()))
}

if database.Local.Connection.Docker != "" {
local = append(local, fmt.Sprintf("Docker:%s", database.Local.Connection.Docker))
} else if database.Local.Hostname != "" {
hostname := database.Local.Hostname

if database.Local.Port != "" {
hostname += ":"+database.Local.Port
}
local = append(local, fmt.Sprintf("Host:%s", hostname))
}

// build parts
switch direction {
Expand Down

0 comments on commit c18719a

Please sign in to comment.