Bladeren bron

Update log levels for storage implementations

Matt Bolt 4 jaren geleden
bovenliggende
commit
6f0e39290d
3 gewijzigde bestanden met toevoegingen van 16 en 20 verwijderingen
  1. 4 4
      pkg/storage/azurestorage.go
  2. 6 6
      pkg/storage/gcsstorage.go
  3. 6 10
      pkg/storage/s3storage.go

+ 4 - 4
pkg/storage/azurestorage.go

@@ -277,7 +277,7 @@ func (b *AzureStorage) Read(name string) ([]byte, error) {
 	name = trimLeading(name)
 	ctx := context.Background()
 
-	log.Infof("AzureStorage::Read(%s)", name)
+	log.Debugf("AzureStorage::Read(%s)", name)
 
 	reader, err := b.getBlobReader(ctx, name, 0, blob.CountToEnd)
 	if err != nil {
@@ -298,7 +298,7 @@ func (b *AzureStorage) Write(name string, data []byte) error {
 	name = trimLeading(name)
 	ctx := context.Background()
 
-	log.Infof("AzureStorage::Write(%s)", name)
+	log.Debugf("AzureStorage::Write(%s)", name)
 
 	blobURL := getBlobURL(name, b.containerURL)
 	r := bytes.NewReader(data)
@@ -318,7 +318,7 @@ func (b *AzureStorage) Write(name string, data []byte) error {
 func (b *AzureStorage) Remove(name string) error {
 	name = trimLeading(name)
 
-	log.Infof("S3Storage::Remove(%s)", name)
+	log.Debugf("AzureStorage::Remove(%s)", name)
 	ctx := context.Background()
 
 	blobURL := getBlobURL(name, b.containerURL)
@@ -350,7 +350,7 @@ func (b *AzureStorage) Exists(name string) (bool, error) {
 func (b *AzureStorage) List(path string) ([]*StorageInfo, error) {
 	path = trimLeading(path)
 
-	log.Infof("S3Storage::List(%s)", path)
+	log.Debugf("AzureStorage::List(%s)", path)
 	ctx := context.Background()
 
 	// Ensure the object name actually ends with a dir suffix. Otherwise we'll just iterate the

+ 6 - 6
pkg/storage/gcsstorage.go

@@ -91,7 +91,7 @@ func (gs *GCSStorage) FullPath(name string) string {
 // Stat returns the StorageStats for the specific path.
 func (gs *GCSStorage) Stat(name string) (*StorageInfo, error) {
 	name = trimLeading(name)
-	//log.Infof("GCSStorage::Stat(%s)", name)]
+	//log.Debugf("GCSStorage::Stat(%s)", name)]
 
 	ctx := context.Background()
 	attrs, err := gs.bucket.Object(name).Attrs(ctx)
@@ -119,7 +119,7 @@ func (gs *GCSStorage) isDoesNotExist(err error) bool {
 // read the contents.
 func (gs *GCSStorage) Read(name string) ([]byte, error) {
 	name = trimLeading(name)
-	log.Infof("GCSStorage::Read(%s)", name)
+	log.Debugf("GCSStorage::Read(%s)", name)
 
 	ctx := context.Background()
 	reader, err := gs.bucket.Object(name).NewReader(ctx)
@@ -139,7 +139,7 @@ func (gs *GCSStorage) Read(name string) ([]byte, error) {
 // to write a new file or overwrite an existing file.
 func (gs *GCSStorage) Write(name string, data []byte) error {
 	name = trimLeading(name)
-	log.Infof("GCSStorage::Write(%s)", name)
+	log.Debugf("GCSStorage::Write(%s)", name)
 
 	ctx := context.Background()
 
@@ -168,7 +168,7 @@ func (gs *GCSStorage) Write(name string, data []byte) error {
 func (gs *GCSStorage) Remove(name string) error {
 	name = trimLeading(name)
 
-	log.Infof("GCSStorage::Remove(%s)", name)
+	log.Debugf("GCSStorage::Remove(%s)", name)
 	ctx := context.Background()
 
 	return gs.bucket.Object(name).Delete(ctx)
@@ -178,7 +178,7 @@ func (gs *GCSStorage) Remove(name string) error {
 // determine if the file exists.
 func (gs *GCSStorage) Exists(name string) (bool, error) {
 	name = trimLeading(name)
-	//log.Infof("GCSStorage::Exists(%s)", name)
+	//log.Debugf("GCSStorage::Exists(%s)", name)
 
 	ctx := context.Background()
 	_, err := gs.bucket.Object(name).Attrs(ctx)
@@ -197,7 +197,7 @@ func (gs *GCSStorage) Exists(name string) (bool, error) {
 func (gs *GCSStorage) List(path string) ([]*StorageInfo, error) {
 	path = trimLeading(path)
 
-	log.Infof("GCSStorage::List(%s)", path)
+	log.Debugf("GCSStorage::List(%s)", path)
 	ctx := context.Background()
 
 	// Ensure the object name actually ends with a dir suffix. Otherwise we'll just iterate the

+ 6 - 10
pkg/storage/s3storage.go

@@ -177,8 +177,6 @@ func parseS3Config(conf []byte) (S3Config, error) {
 
 // NewBucket returns a new Bucket using the provided s3 config values.
 func NewS3Storage(conf []byte) (*S3Storage, error) {
-	log.Infof("Creating new S3 Storage...")
-
 	config, err := parseS3Config(conf)
 	if err != nil {
 		return nil, err
@@ -191,8 +189,6 @@ func NewS3Storage(conf []byte) (*S3Storage, error) {
 func NewS3StorageWith(config S3Config) (*S3Storage, error) {
 	var chain []credentials.Provider
 
-	log.Infof("New S3 Storage With Config: %+v", config)
-
 	wrapCredentialsProvider := func(p credentials.Provider) credentials.Provider { return p }
 	if config.SignatureV2 {
 		wrapCredentialsProvider = func(p credentials.Provider) credentials.Provider {
@@ -350,7 +346,7 @@ func (s3 *S3Storage) FullPath(name string) string {
 func (s3 *S3Storage) Read(name string) ([]byte, error) {
 	name = trimLeading(name)
 
-	log.Infof("S3Storage::Read(%s)", name)
+	log.Debugf("S3Storage::Read(%s)", name)
 	ctx := context.Background()
 
 	return s3.getRange(ctx, name, 0, -1)
@@ -360,7 +356,7 @@ func (s3 *S3Storage) Read(name string) ([]byte, error) {
 // Exists checks if the given object exists.
 func (s3 *S3Storage) Exists(name string) (bool, error) {
 	name = trimLeading(name)
-	//log.Infof("S3Storage::Exists(%s)", name)
+	//log.Debugf("S3Storage::Exists(%s)", name)
 
 	ctx := context.Background()
 
@@ -379,7 +375,7 @@ func (s3 *S3Storage) Exists(name string) (bool, error) {
 func (s3 *S3Storage) Write(name string, data []byte) error {
 	name = trimLeading(name)
 
-	log.Infof("S3Storage::Write(%s)", name)
+	log.Debugf("S3Storage::Write(%s)", name)
 
 	ctx := context.Background()
 	sse, err := s3.getServerSideEncryption(ctx)
@@ -413,7 +409,7 @@ func (s3 *S3Storage) Write(name string, data []byte) error {
 func (s3 *S3Storage) Stat(name string) (*StorageInfo, error) {
 	name = trimLeading(name)
 
-	//log.Infof("S3Storage::Stat(%s)", name)
+	//log.Debugf("S3Storage::Stat(%s)", name)
 	ctx := context.Background()
 
 	objInfo, err := s3.client.StatObject(ctx, s3.name, name, minio.StatObjectOptions{})
@@ -435,7 +431,7 @@ func (s3 *S3Storage) Stat(name string) (*StorageInfo, error) {
 func (s3 *S3Storage) Remove(name string) error {
 	name = trimLeading(name)
 
-	log.Infof("S3Storage::Remove(%s)", name)
+	log.Debugf("S3Storage::Remove(%s)", name)
 	ctx := context.Background()
 
 	return s3.client.RemoveObject(ctx, s3.name, name, minio.RemoveObjectOptions{})
@@ -444,7 +440,7 @@ func (s3 *S3Storage) Remove(name string) error {
 func (s3 *S3Storage) List(path string) ([]*StorageInfo, error) {
 	path = trimLeading(path)
 
-	log.Infof("S3Storage::List(%s)", path)
+	log.Debugf("S3Storage::List(%s)", path)
 	ctx := context.Background()
 
 	// Ensure the object name actually ends with a dir suffix. Otherwise we'll just iterate the