@@ -105,6 +105,8 @@ func New(ctx context.Context, cfg *config.GCSCli) (*GCSBlobstore, error) {
105105// Get fetches a blob from the GCS blobstore.
106106// Destination will be overwritten if it already exists.
107107func (client * GCSBlobstore ) Get (src string , dest string ) error {
108+ log .Printf ("Getting object from '%s/%s' into file '%s'\n " , client .config .BucketName , src , dest )
109+
108110 dstFile , err := os .Create (dest )
109111 if err != nil {
110112 return err
@@ -137,6 +139,8 @@ func (client *GCSBlobstore) getReader(gcs *storage.Client, src string) (*storage
137139const retryAttempts = 3
138140
139141func (client * GCSBlobstore ) Put (sourceFilePath string , dest string ) error {
142+ log .Printf ("Putting file '%s' into '%s/%s'\n " , sourceFilePath , client .config .BucketName , dest )
143+
140144 src , err := os .Open (sourceFilePath )
141145 if err != nil {
142146 return err
@@ -193,6 +197,8 @@ func (client *GCSBlobstore) putOnce(src io.ReadSeeker, dest string) error {
193197//
194198// If the object does not exist, Delete returns a nil error.
195199func (client * GCSBlobstore ) Delete (dest string ) error {
200+ log .Printf ("Deleting object '%s' in bucket '%s' \n " , dest , client .config .BucketName )
201+
196202 if client .readOnly () {
197203 return ErrInvalidROWriteOperation
198204 }
@@ -206,6 +212,8 @@ func (client *GCSBlobstore) Delete(dest string) error {
206212
207213// Exists checks if a blob exists in the GCS blobstore.
208214func (client * GCSBlobstore ) Exists (dest string ) (exists bool , err error ) {
215+ log .Printf ("Checking object '%s' exist in bucket '%s'\n " , dest , client .config .BucketName )
216+
209217 if exists , err = client .exists (client .publicGCS , dest ); err == nil {
210218 return exists , nil
211219 }
@@ -235,6 +243,8 @@ func (client *GCSBlobstore) readOnly() bool {
235243}
236244
237245func (client * GCSBlobstore ) Sign (id string , action string , expiry time.Duration ) (string , error ) {
246+ log .Printf ("Signing object '%s' with method '%s' for '%s' minutes\n " , id , action , expiry .String ())
247+
238248 action = strings .ToUpper (action )
239249 token , err := google .JWTConfigFromJSON ([]byte (client .config .ServiceAccountFile ), storage .ScopeFullControl )
240250 if err != nil {
@@ -263,9 +273,9 @@ func (client *GCSBlobstore) Sign(id string, action string, expiry time.Duration)
263273
264274func (client * GCSBlobstore ) List (prefix string ) ([]string , error ) {
265275 if prefix != "" {
266- log .Printf ("Listing objects in bucket %s with prefix '%s'\n " , client .config .BucketName , prefix )
276+ log .Printf ("Listing objects in bucket '%s' with prefix '%s'\n " , client .config .BucketName , prefix )
267277 } else {
268- log .Printf ("Listing objects in bucket %s \n " , client .config .BucketName )
278+ log .Printf ("Listing objects in bucket '%s' \n " , client .config .BucketName )
269279 }
270280 if client .readOnly () {
271281 return nil , ErrInvalidROWriteOperation
@@ -294,7 +304,7 @@ func (client *GCSBlobstore) List(prefix string) ([]string, error) {
294304}
295305
296306func (client * GCSBlobstore ) Copy (srcBlob string , dstBlob string ) error {
297- log .Printf ("copying an object from %s to %s \n " , srcBlob , dstBlob )
307+ log .Printf ("Copying an object from '%s/%s' to '%s/%s' \n " , srcBlob , client . config . BucketName , dstBlob , client . config . BucketName )
298308 if client .readOnly () {
299309 return ErrInvalidROWriteOperation
300310 }
@@ -310,7 +320,7 @@ func (client *GCSBlobstore) Copy(srcBlob string, dstBlob string) error {
310320}
311321
312322func (client * GCSBlobstore ) Properties (dest string ) error {
313- log .Printf ("Getting properties for object %s/%s \n " , client .config .BucketName , dest )
323+ log .Printf ("Getting properties for object '%s' in bucket '%s' \n " , dest , client .config .BucketName )
314324 if client .readOnly () {
315325 return ErrInvalidROWriteOperation
316326 }
@@ -375,10 +385,10 @@ func (client *GCSBlobstore) EnsureStorageExists() error {
375385
376386func (client * GCSBlobstore ) DeleteRecursive (prefix string ) error {
377387 if prefix != "" {
378- log .Printf ("Deleting all objects in bucket %s with prefix '%s'\n " ,
388+ log .Printf ("Deleting all objects in bucket '%s' with prefix '%s'\n " ,
379389 client .config .BucketName , prefix )
380390 } else {
381- log .Printf ("Deleting all objects in bucket %s \n " , client .config .BucketName )
391+ log .Printf ("Deleting all objects in bucket '%s' \n " , client .config .BucketName )
382392 }
383393
384394 if client .readOnly () {
0 commit comments