From f42104fa067073c81f845bda4abbe357edf7339b Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:40:28 +0200 Subject: [PATCH] chore(outputs.remotefile): Deprecate trace option (#15970) --- plugins/outputs/remotefile/README.md | 4 ---- plugins/outputs/remotefile/remotefile.go | 9 +++++---- plugins/outputs/remotefile/sample.conf | 4 ---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/plugins/outputs/remotefile/README.md b/plugins/outputs/remotefile/README.md index 360475e9d..9277707bd 100644 --- a/plugins/outputs/remotefile/README.md +++ b/plugins/outputs/remotefile/README.md @@ -63,10 +63,6 @@ to use them. ## Maximum size of the cache on disk (infinite by default) # cache_max_size = -1 - ## Output log messages of the underlying library as debug messages - ## NOTE: You need to enable this option AND run Telegraf in debug mode! - # trace = false - ## Data format to output. ## Each data format has its own unique set of configuration options, read ## more about them here: diff --git a/plugins/outputs/remotefile/remotefile.go b/plugins/outputs/remotefile/remotefile.go index 29e21c625..c1c60a6ce 100644 --- a/plugins/outputs/remotefile/remotefile.go +++ b/plugins/outputs/remotefile/remotefile.go @@ -34,7 +34,7 @@ type File struct { WriteBackInterval config.Duration `toml:"cache_write_back"` MaxCacheSize config.Size `toml:"cache_max_size"` UseBatchFormat bool `toml:"use_batch_format"` - Trace bool `toml:"trace"` + Trace bool `toml:"trace" deprecated:"1.33.0;1.35.0;use 'log_level = \"trace\"' instead"` Log telegraf.Logger `toml:"-"` root *vfs.VFS @@ -81,10 +81,11 @@ func (f *File) Init() error { // Redirect logging fs.LogPrint = func(level fs.LogLevel, text string) { - if !f.Trace { - return + if f.Trace { + f.Log.Debugf("[%s] %s", level.String(), text) + } else { + f.Log.Tracef("[%s] %s", level.String(), text) } - f.Log.Debugf("[%s] %s", level.String(), text) } // Setup custom template functions diff --git a/plugins/outputs/remotefile/sample.conf b/plugins/outputs/remotefile/sample.conf index b40631cfd..273cb9879 100644 --- a/plugins/outputs/remotefile/sample.conf +++ b/plugins/outputs/remotefile/sample.conf @@ -33,10 +33,6 @@ ## Maximum size of the cache on disk (infinite by default) # cache_max_size = -1 - ## Output log messages of the underlying library as debug messages - ## NOTE: You need to enable this option AND run Telegraf in debug mode! - # trace = false - ## Data format to output. ## Each data format has its own unique set of configuration options, read ## more about them here: