Skip to content

Commit

Permalink
Improve string representations
Browse files Browse the repository at this point in the history
  • Loading branch information
David Moles committed Jan 10, 2019
1 parent baf6440 commit bd66c24
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func (l terseLogger) Verbose() bool {
return false
}

func (l terseLogger) String() string {
return "terse"
}

// ------------------------------
// verboseLogger

Expand All @@ -100,3 +104,7 @@ func (l verboseLogger) Detailf(format string, a ...interface{}) {
func (l verboseLogger) Verbose() bool {
return true
}

func (l verboseLogger) String() string {
return "verbose"
}
19 changes: 19 additions & 0 deletions internal/object_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,25 @@ func (ol *objLoc) DownloadTo(w io.WriterAt) (int64, error) {
return downloader.Download(w, ol.toGetObjectInput())
}

func (ol *objLoc) String() string {
var endpointStr string
if ol.endpoint == nil {
endpointStr = "<nil>"
} else {
endpointStr = ol.Endpoint().String()
}
var sessionStr string
if ol.awsSession == nil {
sessionStr = "<nil>"
} else {
sessionStr = "(initialized)"
}
return fmt.Sprintf(
"{region: %v, endpoint: %v, bucket: %v, key: %v, logger: %v, awsSession: %v}",
ol.region, endpointStr, ol.bucket, ol.key, ol.logger, sessionStr,
)
}

// ------------------------------------------------------------
// Unexported functions

Expand Down

0 comments on commit bd66c24

Please sign in to comment.