Skip to content

Commit

Permalink
remove dafault flags to avoid confliction
Browse files Browse the repository at this point in the history
  • Loading branch information
absolute8511 committed Dec 31, 2015
1 parent ad49d2b commit 7d46377
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,21 +396,20 @@ type flushSyncWriter interface {
}

func init() {
flag.BoolVar(&logging.toStderr, "logtostderr", false, "log to standard error instead of files")
flag.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files")
flag.Var(&logging.verbosity, "v", "log level for V logs")
flag.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr")
flag.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
flag.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")
logging.flag = flag.CommandLine

// Default stderrThreshold is ERROR.
logging.stderrThreshold = errorLog
logging.alsoToStderr = true

logging.setVState(0, nil, false)
go logging.flushDaemon()
}

func SetFlags(verbosity Level, stderrThres int32) {
logging.verbosity = verbosity
logging.stderrThreshold = severity(stderrThres)
}

func InitWithFlag(f *flag.FlagSet) {
if f == nil {
os.Stderr.Write([]byte("ERROR: init with nil flagset"))
Expand Down

0 comments on commit 7d46377

Please sign in to comment.