Browse code

devmapper: initialize log levels

Signed-off-by: Vincent Batts <vbatts@redhat.com>

Vincent Batts authored on 2015/01/20 04:43:19
Showing 1 changed files
... ...
@@ -717,8 +717,10 @@ func setCloseOnExec(name string) {
717 717
 }
718 718
 
719 719
 func (devices *DeviceSet) DMLog(level int, file string, line int, dmError int, message string) {
720
-	if level >= 7 {
721
-		return // Ignore _LOG_DEBUG
720
+	if level >= devicemapper.LogLevelDebug {
721
+		// (vbatts) libdm debug is very verbose. If you're debugging libdm, you can
722
+		// comment out this check yourself
723
+		level = devicemapper.LogLevelInfo
722 724
 	}
723 725
 
724 726
 	// FIXME(vbatts) push this back into ./pkg/devicemapper/
... ...
@@ -939,6 +941,11 @@ func (devices *DeviceSet) closeTransaction() error {
939 939
 }
940 940
 
941 941
 func (devices *DeviceSet) initDevmapper(doInit bool) error {
942
+	if os.Getenv("DEBUG") != "" {
943
+		devicemapper.LogInitVerbose(devicemapper.LogLevelDebug)
944
+	} else {
945
+		devicemapper.LogInitVerbose(devicemapper.LogLevelWarn)
946
+	}
942 947
 	// give ourselves to libdm as a log handler
943 948
 	devicemapper.LogInit(devices)
944 949