Document and add support to input plugins for logging alias (#6357)

This commit is contained in:
Greg
2019-09-23 16:39:50 -06:00
committed by Daniel Nelson
parent e42d2e39c6
commit 817c9a69a9
111 changed files with 961 additions and 659 deletions

View File

@@ -1,7 +1,6 @@
package filecount
import (
"log"
"os"
"path/filepath"
"time"
@@ -59,6 +58,7 @@ type FileCount struct {
fileFilters []fileFilterFunc
globPaths []globpath.GlobPath
Fs fileSystem
Log telegraf.Logger
}
func (_ *FileCount) Description() string {
@@ -210,7 +210,7 @@ func (fc *FileCount) count(acc telegraf.Accumulator, basedir string, glob globpa
Unsorted: true,
ErrorCallback: func(osPathname string, err error) godirwalk.ErrorAction {
if os.IsPermission(errors.Cause(err)) {
log.Println("D! [inputs.filecount]", err)
fc.Log.Debug(err)
return godirwalk.SkipNode
}
return godirwalk.Halt

View File

@@ -152,6 +152,7 @@ func TestDirectoryWithTrailingSlash(t *testing.T) {
func getNoFilterFileCount() FileCount {
return FileCount{
Log: testutil.Logger{},
Directories: []string{getTestdataDir()},
Name: "*",
Recursive: true,