mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
lib/fs: Introduce walkfs debug facility (#4712)
This commit is contained in:
parent
043b04d8a6
commit
8a3e584c19
@ -18,5 +18,12 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
l.SetDebug("fs", strings.Contains(os.Getenv("STTRACE"), "fs") || os.Getenv("STTRACE") == "all")
|
logger.DefaultLogger.NewFacility("walkfs", "Filesystem access while walking")
|
||||||
|
switch {
|
||||||
|
case strings.Contains(os.Getenv("STTRACE"), "walkfs") || os.Getenv("STTRACE") == "all":
|
||||||
|
l.SetDebug("walkfs", true)
|
||||||
|
fallthrough
|
||||||
|
case strings.Contains(os.Getenv("STTRACE"), "fs"):
|
||||||
|
l.SetDebug("fs", true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ func NewFilesystem(fsType FilesystemType, uri string) Filesystem {
|
|||||||
var fs Filesystem
|
var fs Filesystem
|
||||||
switch fsType {
|
switch fsType {
|
||||||
case FilesystemTypeBasic:
|
case FilesystemTypeBasic:
|
||||||
fs = NewWalkFilesystem(newBasicFilesystem(uri))
|
fs = newBasicFilesystem(uri)
|
||||||
default:
|
default:
|
||||||
l.Debugln("Unknown filesystem", fsType, uri)
|
l.Debugln("Unknown filesystem", fsType, uri)
|
||||||
fs = &errorFilesystem{
|
fs = &errorFilesystem{
|
||||||
@ -170,10 +170,15 @@ func NewFilesystem(fsType FilesystemType, uri string) Filesystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.ShouldDebug("fs") {
|
if l.ShouldDebug("walkfs") {
|
||||||
fs = &logFilesystem{fs}
|
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
|
// IsInternal returns true if the file, as a path relative to the folder
|
||||||
|
Loading…
Reference in New Issue
Block a user