"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
log: add object and objectType to json logs
justina77794ee43fe54d2
diff --git a/fs/log.go b/fs/log.goindex 31fe6c2a0..68f09e9cc 100644--- a/fs/log.go+++ b/fs/log.go@@ -77,25 +77,33 @@ var LogPrint = func(level LogLevel, text string) {// LogPrintf produces a log string from the arguments passed infunc LogPrintf(level LogLevel, o interface{}, text string, args ...interface{}) {out := fmt.Sprintf(text, args...)- if o != nil {- out = fmt.Sprintf("%v: %s", o, out)- }+if Config.UseJSONLog {+ fields := logrus.Fields{}+ if o != nil {+ fields = logrus.Fields{+ "object": fmt.Sprintf("%+v", o),+ "objectType": fmt.Sprintf("%T", o),+ }+ }switch level {case LogLevelDebug:- logrus.Debug(out)+ logrus.WithFields(fields).Debug(out)case LogLevelInfo:- logrus.Info(out)+ logrus.WithFields(fields).Info(out)case LogLevelNotice, LogLevelWarning:- logrus.Warn(out)+ logrus.WithFields(fields).Warn(out)case LogLevelError:- logrus.Error(out)+ logrus.WithFields(fields).Error(out)case LogLevelCritical:- logrus.Fatal(out)+ logrus.WithFields(fields).Fatal(out)case LogLevelEmergency, LogLevelAlert:- logrus.Panic(out)+ logrus.WithFields(fields).Panic(out)}} else {+ if o != nil {+ out = fmt.Sprintf("%v: %s", o, out)+ }LogPrint(level, out)}}