glog.go
func (l *Log) setV(pc uintptr) Level {
	fn := runtime.FuncForPC(pc)
	file, _ := fn.FileLine(pc)
	// The file is something like /a/b/c/d.go. We want just the d.
	if strings.HasSuffix(file, ".go") {
		file = file[:len(file)-3]
	}
	module := file
	if slash := strings.LastIndex(file, "/"); slash >= 0 {
		module = file[slash+1:]
	}
	for _, filter := range l.vmodule.filter {
		if filter.match(module) {
			l.vmap[pc] = filter.level
			return filter.level
		}
	}
	for _, filter := range l.vfilepath.filter {
		if filter.match(file) {
			l.vmap[pc] = filter.level
			return filter.level
		}
	}
	l.vmap[pc] = 0
	return 0
}
func (l *Log) setV(pc uintptr) Level {
	fn := runtime.FuncForPC(pc)
	file, _ := fn.FileLine(pc)
	// The file is something like /a/b/c/d.go. We want just the d.
	if strings.HasSuffix(file, ".go") {
		file = file[:len(file)-3]
	}
	module := file
	if slash := strings.LastIndex(file, "/"); slash >= 0 {
		module = file[slash+1:]
	}
	for _, filter := range l.vmodule.filter {
		if filter.match(module) {
			l.vmap[pc] = filter.level
			return filter.level
		}
	}
	for _, filter := range l.vfilepath.filter {
		if filter.match(file) {
			l.vmap[pc] = filter.level
			return filter.level
		}
	}
	l.vmap[pc] = 0
	return 0
}
func ( l * Log ) setV ( pc uintptr ) Level { fn := runtime . FuncForPC ( pc ) file , _ := fn . FileLine ( pc ) // The file is something like /a/b/c/d.go. We want just the d. if strings . HasSuffix ( file , " " ) { file = file [ : len ( file ) - 3 ] } module := file if slash := strings . LastIndex ( file , " " ) ; slash >= 0 { module = file [ slash + 1 : ] } for _ , filter := range l . vmodule . filter { if filter . match ( module ) { l . vmap [ pc ] = filter . level return filter . level } } for _ , filter := range l . vfilepath . filter { if filter . match ( file ) { l . vmap [ pc ] = filter . level return filter . level } } l . vmap [ pc ] = 0 return 0 }
// 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 270.Match, which is a little more
// general than the *? matching used in C++.
// l.mu is held.
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 270 . Match which is a little more general than the * ? matching used in C ++ . l . mu is held .