示例#1
0
文件: gofig.go 项目: akutz/gofig
func (c *scopedConfig) Scope(scope interface{}) types.Config {
	szScope := toString(scope)
	if log.GetLevel() == log.DebugLevel {
		scopes := []string{}
		var p types.Config = c
		for {
			scopes = append(scopes, p.GetScope())
			p = p.Parent()
			if p == nil {
				break
			}
		}
		log.WithFields(log.Fields{
			"new":          szScope,
			"parentScopes": strings.Join(scopes, ","),
		}).Debug("created scoped scope")
	}
	return &scopedConfig{Config: c, scope: szScope}
}