lib/fs: Introduce walkfs debug facility (#4712)

This commit is contained in:
Simon Frei
2018-02-05 11:07:56 +01:00
committed by Jakob Borg
parent 043b04d8a6
commit 8a3e584c19
2 changed files with 17 additions and 5 deletions

View File

@@ -160,7 +160,7 @@ func NewFilesystem(fsType FilesystemType, uri string) Filesystem {
var fs Filesystem
switch fsType {
case FilesystemTypeBasic:
fs = NewWalkFilesystem(newBasicFilesystem(uri))
fs = newBasicFilesystem(uri)
default:
l.Debugln("Unknown filesystem", fsType, uri)
fs = &errorFilesystem{
@@ -170,10 +170,15 @@ func NewFilesystem(fsType FilesystemType, uri string) Filesystem {
}
}
if l.ShouldDebug("fs") {
fs = &logFilesystem{fs}
if l.ShouldDebug("walkfs") {
return NewWalkFilesystem(&logFilesystem{fs})
}
return fs
if l.ShouldDebug("fs") {
return &logFilesystem{NewWalkFilesystem(fs)}
}
return NewWalkFilesystem(fs)
}
// IsInternal returns true if the file, as a path relative to the folder