Browse Source

do not copy a logger

main v0.0.1
Nicolas Massé 4 years ago
parent
commit
cd3bd2ad92
  1. 4
      archive.go
  2. 2
      cli/cmd/archive.go

4
archive.go

@ -66,7 +66,7 @@ type Archiver struct {
S3Config S3Config // credentials to connect to S3 S3Config S3Config // credentials to connect to S3
MqttConfig MqttConfig // credentials to connect to MQTT MqttConfig MqttConfig // credentials to connect to MQTT
WorkingDir string // location to store JSON files WorkingDir string // location to store JSON files
Logger log.Logger // a logger Logger *log.Logger // a logger
SubscribePattern string // the pattern (ie. "#") to subscribe to SubscribePattern string // the pattern (ie. "#") to subscribe to
FilterRegex string // topics matching this regex will filtered out FilterRegex string // topics matching this regex will filtered out
filter *regexp.Regexp // compiled regex: topics matching this regex will filtered out filter *regexp.Regexp // compiled regex: topics matching this regex will filtered out
@ -90,7 +90,7 @@ func (archiver *Archiver) StartArchive() error {
archiver.filter = regexp.MustCompile(archiver.FilterRegex) archiver.filter = regexp.MustCompile(archiver.FilterRegex)
// connect to MQTT server // connect to MQTT server
SetMqttLogger(&archiver.Logger) SetMqttLogger(archiver.Logger)
archiver.Logger.Println("Connecting to MQTT server...") archiver.Logger.Println("Connecting to MQTT server...")
var err error var err error
archiver.client, err = NewMqttClient(archiver.MqttConfig) archiver.client, err = NewMqttClient(archiver.MqttConfig)

2
cli/cmd/archive.go

@ -81,7 +81,7 @@ var archiveCmd = &cobra.Command{
SubscribePattern: viper.GetString("subscribePattern"), SubscribePattern: viper.GetString("subscribePattern"),
WorkingDir: viper.GetString("workingDir"), WorkingDir: viper.GetString("workingDir"),
FilterRegex: viper.GetString("exclude"), FilterRegex: viper.GetString("exclude"),
Logger: *logger, Logger: logger,
} }
// trap SIGINT and SIGTEM to gracefully stop // trap SIGINT and SIGTEM to gracefully stop

Loading…
Cancel
Save