"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: convert options to new style
Nick Craig-Wooddce831704249
diff --git a/fs/log/log.go b/fs/log/log.goindex bf2bfd74b..0877f5d72 100644--- a/fs/log/log.go+++ b/fs/log/log.go@@ -14,23 +14,49 @@ import ("github.com/sirupsen/logrus")+// OptionsInfo descripts the Options in use+var OptionsInfo = fs.Options{{+ Name: "log_file",+ Default: "",+ Help: "Log everything to this file",+ Groups: "Logging",+}, {+ Name: "log_format",+ Default: "date,time",+ Help: "Comma separated list of log format options",+ Groups: "Logging",+}, {+ Name: "syslog",+ Default: false,+ Help: "Use Syslog for logging",+ Groups: "Logging",+}, {+ Name: "syslog_facility",+ Default: "DAEMON",+ Help: "Facility for syslog, e.g. KERN,USER",+ Groups: "Logging",+}, {+ Name: "log_systemd",+ Default: false,+ Help: "Activate systemd integration for the logger",+ Groups: "Logging",+}}+// Options contains options for controlling the loggingtype Options struct {- File string // Log everything to this file- Format string // Comma separated list of log format options- UseSyslog bool // Use Syslog for logging- SyslogFacility string // Facility for syslog, e.g. KERN,USER,...- LogSystemdSupport bool // set if using systemd logging+ File string `config:"log_file"` // Log everything to this file+ Format string `config:"log_format"` // Comma separated list of log format options+ UseSyslog bool `config:"syslog"` // Use Syslog for logging+ SyslogFacility string `config:"syslog_facility"` // Facility for syslog, e.g. KERN,USER,...+ LogSystemdSupport bool `config:"log_systemd"` // set if using systemd logging}-// DefaultOpt is the default values used for Opt-var DefaultOpt = Options{- Format: "date,time",- SyslogFacility: "DAEMON",+func init() {+ fs.RegisterGlobalOptions(fs.OptionsInfo{Name: "log", Opt: &Opt, Options: OptionsInfo})}// Opt is the options for the logger-var Opt = DefaultOpt+var Opt Options// fnName returns the name of the calling +2 functionfunc fnName() string {diff --git a/fs/log/logflags/logflags.go b/fs/log/logflags/logflags.goindex d1d3c8d89..4c02e7ea5 100644--- a/fs/log/logflags/logflags.go+++ b/fs/log/logflags/logflags.go@@ -4,17 +4,10 @@ package logflagsimport ("github.com/rclone/rclone/fs/config/flags""github.com/rclone/rclone/fs/log"- "github.com/rclone/rclone/fs/rc""github.com/spf13/pflag")// AddFlags adds the log flags to the flagSetfunc AddFlags(flagSet *pflag.FlagSet) {- rc.AddOption("log", &log.Opt)-- flags.StringVarP(flagSet, &log.Opt.File, "log-file", "", log.Opt.File, "Log everything to this file", "Logging")- flags.StringVarP(flagSet, &log.Opt.Format, "log-format", "", log.Opt.Format, "Comma separated list of log format options", "Logging")- flags.BoolVarP(flagSet, &log.Opt.UseSyslog, "syslog", "", log.Opt.UseSyslog, "Use Syslog for logging", "Logging")- flags.StringVarP(flagSet, &log.Opt.SyslogFacility, "syslog-facility", "", log.Opt.SyslogFacility, "Facility for syslog, e.g. KERN,USER,...", "Logging")- flags.BoolVarP(flagSet, &log.Opt.LogSystemdSupport, "log-systemd", "", log.Opt.LogSystemdSupport, "Activate systemd integration for the logger", "Logging")+ flags.AddFlagsFromOptions(flagSet, "", log.OptionsInfo)}