LoginSignup
0
0

More than 5 years have passed since last update.

コマンドラインの引数ではなくプログラムでglogの設定を行う方法

Posted at

結論

flag.Setを使います。

例えば、stderrthresholdで、ログレベルの閾値を設定したい場合は、以下のようになります。

func main() {
    flag.Set("stderrthreshold", "INFO")
    flag.Parse()

    glog.Info("Hoge")
}

参照

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0