// New returns a struct that implements -v and -vmodule support. Changing and // checking these settings is thread-safe, with all concurrency issues handled // internally. func New() *VState { … } type Value … func (vs *VState) V() Value { … } func (vs *VState) VModule() Value { … } type VState … type Level … type levelSpec … // get returns the value of the level. func (l *levelSpec) get() Level { … } // set sets the value of the level. func (l *levelSpec) set(val Level) { … } // String is part of the flag.Value interface. func (l *levelSpec) String() string { … } // Get is part of the flag.Getter interface. It returns the // verbosity level as int32. func (l *levelSpec) Get() interface{ … } // Type is part of pflag.Value. func (l *levelSpec) Type() string { … } // Set is part of the flag.Value interface. func (l *levelSpec) Set(value string) error { … } type moduleSpec … type modulePat … // match reports whether the file matches the pattern. It uses a string // comparison if the pattern contains no metacharacters. func (m *modulePat) match(file string) bool { … } func (m *moduleSpec) String() string { … } // Get is part of the (Go 1.2) flag.Getter interface. It always returns nil for this flag type since the // struct is not exported. func (m *moduleSpec) Get() interface{ … } // Type is part of pflag.Value func (m *moduleSpec) Type() string { … } var errVmoduleSyntax … // Set will sets module value // Syntax: -vmodule=recordio=2,file=1,gfs*=3 func (m *moduleSpec) Set(value string) error { … } // isLiteral reports whether the pattern is a literal string, that is, has no metacharacters // that require filepath.Match to be called to match the pattern. func isLiteral(pattern string) bool { … } // set sets a consistent state for V logging. // The mutex must be held. func (vs *VState) set(l Level, filter []modulePat, setFilter bool) { … } // Enabled checks whether logging is enabled at the given level. This must be // called with depth=0 when the caller of enabled will do the logging and // higher values when more stack levels need to be skipped. // // The mutex will be locked only if needed. func (vs *VState) Enabled(level Level, depth int) bool { … } // setV computes and remembers the V level for a given PC // when vmodule is enabled. // File pattern matching takes the basename of the file, stripped // of its .go suffix, and uses filepath.Match, which is a little more // general than the *? matching used in C++. // Mutex is held. func (vs *VState) setV(pc uintptr) Level { … }