Logging in odo

Glog is used for V style logging in odo.


Every odo command takes an optional flag -v that must be used with an integer log level in the range from 0-9. Any INFO severity log statement that is logged at a level lesser than or equal to the one passed with the command alongside -v flag will be logged to STDOUT.

All ERROR severity level log messages will always be logged regardless of the passed v level.


Every source file that requires logging will need to import glog:

$ import "github.com/golang/glog"

Any default debug level severity messages need to be logged using:

$ glog.V(4).Infof(msg, args...)`

For more information on level logging conventions please refer here.

Error messages can be logged as under:

$ glog.Errorf(msg, args...)

Warning messages can be logged as under:

$ glog.Warningf(msg, args...)

In addition to the above logging, the following hidden flags are available for debugging:

      --alsologtostderr                  log to standard error as well as files
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --logtostderr                      log to standard error instead of files (default false)
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          log level for V logs. Level varies from 0 to 9 (default 0).
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging