Exemplo n.º 1
0
Arquivo: gofig.go Projeto: 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}
}