Skip to content

Commit c18719a

Browse files
committed
Improve logging output for database connections
1 parent a873c21 commit c18719a

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

sync/database.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,15 @@ func (database *Database) String(direction string) string {
4949

5050
// remote
5151
remote = append(remote, fmt.Sprintf("Schema:%s", database.Schema))
52+
remote = append(remote, fmt.Sprintf("Connection:%s", database.Connection.GetType()))
5253

53-
if database.Hostname != "" {
54+
if database.Connection.SshConnectionHostnameString() != "" {
55+
remote = append(remote, fmt.Sprintf("SSH:%s", database.Connection.SshConnectionHostnameString()))
56+
}
57+
58+
if database.Connection.Docker != "" {
59+
remote = append(remote, fmt.Sprintf("Docker:%s", database.Connection.Docker))
60+
} else if database.Hostname != "" {
5461
hostname := database.Hostname
5562

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

7077
// local
7178
local = append(local, fmt.Sprintf("Schema:%s", database.Local.Schema))
79+
local = append(local, fmt.Sprintf("Connection:%s", database.Local.Connection.GetType()))
80+
81+
if database.Local.Connection.SshConnectionHostnameString() != "" {
82+
local = append(local, fmt.Sprintf("SSH:%s", database.Local.Connection.SshConnectionHostnameString()))
83+
}
84+
85+
if database.Local.Connection.Docker != "" {
86+
local = append(local, fmt.Sprintf("Docker:%s", database.Local.Connection.Docker))
87+
} else if database.Local.Hostname != "" {
88+
hostname := database.Local.Hostname
89+
90+
if database.Local.Port != "" {
91+
hostname += ":"+database.Local.Port
92+
}
93+
local = append(local, fmt.Sprintf("Host:%s", hostname))
94+
}
7295

7396
// build parts
7497
switch direction {

0 commit comments

Comments
 (0)