mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #10193 from vbatts/vbatts-dm_logging
devmapper: initialize log levels
This commit is contained in:
commit
fa7af79885
2 changed files with 20 additions and 2 deletions
|
@ -717,8 +717,10 @@ func setCloseOnExec(name string) {
|
|||
}
|
||||
|
||||
func (devices *DeviceSet) DMLog(level int, file string, line int, dmError int, message string) {
|
||||
if level >= 7 {
|
||||
return // Ignore _LOG_DEBUG
|
||||
if level >= devicemapper.LogLevelDebug {
|
||||
// (vbatts) libdm debug is very verbose. If you're debugging libdm, you can
|
||||
// comment out this check yourself
|
||||
level = devicemapper.LogLevelInfo
|
||||
}
|
||||
|
||||
// FIXME(vbatts) push this back into ./pkg/devicemapper/
|
||||
|
@ -939,6 +941,11 @@ func (devices *DeviceSet) closeTransaction() error {
|
|||
}
|
||||
|
||||
func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||
if os.Getenv("DEBUG") != "" {
|
||||
devicemapper.LogInitVerbose(devicemapper.LogLevelDebug)
|
||||
} else {
|
||||
devicemapper.LogInitVerbose(devicemapper.LogLevelWarn)
|
||||
}
|
||||
// give ourselves to libdm as a log handler
|
||||
devicemapper.LogInit(devices)
|
||||
|
||||
|
|
11
pkg/devicemapper/log.go
Normal file
11
pkg/devicemapper/log.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package devicemapper
|
||||
|
||||
// definitions from lvm2 lib/log/log.h
|
||||
const (
|
||||
LogLevelFatal = 2 + iota // _LOG_FATAL
|
||||
LogLevelErr // _LOG_ERR
|
||||
LogLevelWarn // _LOG_WARN
|
||||
LogLevelNotice // _LOG_NOTICE
|
||||
LogLevelInfo // _LOG_INFO
|
||||
LogLevelDebug // _LOG_DEBUG
|
||||
)
|
Loading…
Add table
Reference in a new issue