Skip to content

[Feature] Add a switch to support the debug of the "config loaded" information during configuration loading and enable the option to freely turn it off. #3754

@aide-cloud

Description

@aide-cloud
// config.go 102
func (c *config) Load() error {
	for _, src := range c.opts.sources {
		kvs, err := src.Load()
		if err != nil {
			return err
		}
		// Add a flexible control switch to enable users to freely activate the "loaded" log, rather than relying on the log level for control.
		if c.printLoadedDebugLog {
			for _, v := range kvs {
				log.Debugf("config loaded: %s format: %s", v.Key, v.Format)
			}
		}
		
		if err = c.reader.Merge(kvs...); err != nil {
			log.Errorf("failed to merge config source: %v", err)
			return err
		}
		w, err := src.Watch()
		if err != nil {
			log.Errorf("failed to watch config source: %v", err)
			return err
		}
		c.watchers = append(c.watchers, w)
		go c.watch(w)
	}
	if err := c.reader.Resolve(); err != nil {
		log.Errorf("failed to resolve config source: %v", err)
		return err
	}
	return nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions