Skip to content

Commit

Permalink
Capture error and Dlog level
Browse files Browse the repository at this point in the history
  • Loading branch information
Spellchaser authored Nov 1, 2017
1 parent eabbc0a commit ea166bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ func initLogging() {
flag.Parse()

if _, err := os.Stat(flag.Lookup("log_dir").Value.String()); os.IsNotExist(err) {
if (os.MkdirAll(flag.Lookup("log_dir").Value.String(), os.ModePerm) != nil) {
err = os.MkdirAll(flag.Lookup("log_dir").Value.String(), os.ModePerm)
if (err != nil) {
glog.Errorf("Failed to open custom log directory; defaulting to /tmp! Error: %v", flag.Lookup("log_dir").Value, err)
} else {
glog.V(3).Infof("Created custom logging %s directory!", flag.Lookup("log_dir").Value, err)
glog.V(8).Infof("Created custom logging %s directory!", flag.Lookup("log_dir").Value)
}
}
// Since km runs as a k8 pod, log everything to stderr (stdout not supported)
Expand Down

0 comments on commit ea166bb

Please sign in to comment.