func (c *Config) EnableDebug() error {
	if !c.Debug {
		return nil
	}

	// Base path for storing debug logs.
	r := c.DebugPath
	if r == "" {
		r = filepath.Join(os.Getenv("HOME"), ".govmomi")
	}
	r = filepath.Join(r, "debug")

	// Path for this particular run.
	run := c.DebugPathRun
	if run == "" {
		now := time.Now().Format("2006-01-02T15-04-05.999999999")
		r = filepath.Join(r, now)
	} else {
		// reuse the same path
		r = filepath.Join(r, run)
		_ = os.RemoveAll(r)
	}

	err := os.MkdirAll(r, 0700)
	if err != nil {
		log.Printf("[ERROR] Client debug setup failed: %v", err)
		return err
	}

	p := debug.FileProvider{
		Path: r,
	}

	debug.SetProvider(&p)
	return nil
}
func (c *Config) EnableDebug() error {
	if !c.Debug {
		return nil
	}

	
	r := c.DebugPath
	if r == "" {
		r = filepath.Join(os.Getenv("HOME"), ".govmomi")
	}
	r = filepath.Join(r, "debug")

	
	run := c.DebugPathRun
	if run == "" {
		now := time.Now().Format("2006-01-02T15-04-05.999999999")
		r = filepath.Join(r, now)
	} else {
		
		r = filepath.Join(r, run)
		_ = os.RemoveAll(r)
	}

	err := os.MkdirAll(r, 0700)
	if err != nil {
		log.Printf("[ERROR] Client debug setup failed: %v", err)
		return err
	}

	p := debug.FileProvider{
		Path: r,
	}

	debug.SetProvider(&p)
	return nil
}
func ( c * Config ) EnableDebug ( ) error { if ! c . Debug { return nil } // Base path for storing debug logs. r := c . DebugPath if r == " " { r = filepath . Join ( os . Getenv ( " " ) , " " ) } r = filepath . Join ( r , " " ) // Path for this particular run. run := c . DebugPathRun if run == " " { now := time . Now ( ) . Format ( " " ) r = filepath . Join ( r , now ) } else { // reuse the same path r = filepath . Join ( r , run ) _ = os . RemoveAll ( r ) } err := os . MkdirAll ( r , 0700 ) if err != nil { log . Printf ( " " , err ) return err } p := debug . FileProvider { Path : r , } debug . SetProvider ( & p ) return nil }
// EnableDebug turns on govmomi API operation logging, if appropriate settings
// are set on the provider.
EnableDebug turns on govmomi API operation logging if appropriate settings are set on the provider .