@@ -155,27 +155,19 @@ func (b *Buffer) Name() string {
155155
156156func (b * Buffer ) Params (_ plugins.SecretLoader ) (* params.PluginStore , error ) {
157157 ps := params .NewPluginStore (b .Name ())
158- if b .Id != nil {
159- ps .InsertPairs ("@id" , fmt .Sprint (* b .Id ))
160- }
158+ params .InsertPairs (ps , "@id" , b .Id )
161159 if b .Type != nil {
162160 ps .InsertType (fmt .Sprint (* b .Type ))
163161 }
164- if b .LogLevel != nil {
165- ps .InsertPairs ("@log_level" , fmt .Sprint (* b .LogLevel ))
166- }
162+ params .InsertPairs (ps , "@log_level" , b .LogLevel )
167163
168164 if b .FileBuffer != nil && b .PathSuffix != nil {
169165 ps .InsertPairs ("path_suffix" , * b .PathSuffix )
170166 }
171167
172168 if b .FileSingleBuffer != nil {
173- if b .CalcNumRecords != nil {
174- ps .InsertPairs ("calc_num_records" , * b .CalcNumRecords )
175- }
176- if b .ChunkFormat != nil {
177- ps .InsertPairs ("chunk_format" , * b .ChunkFormat )
178- }
169+ params .InsertPairs (ps , "calc_num_records" , b .CalcNumRecords )
170+ params .InsertPairs (ps , "chunk_format" , b .ChunkFormat )
179171 }
180172
181173 if b .Path != nil {
@@ -193,123 +185,45 @@ func (b *Buffer) Params(_ plugins.SecretLoader) (*params.PluginStore, error) {
193185 }
194186 }
195187
196- if b .TimeKey != nil {
197- ps .InsertPairs ("timekey" , fmt .Sprint (* b .TimeKey ))
198- }
199-
200- if b .TimeKeyWait != nil {
201- ps .InsertPairs ("timekey_wait" , fmt .Sprint (* b .TimeKeyWait ))
202- }
188+ params .InsertPairs (ps , "timekey" , b .TimeKey )
189+ params .InsertPairs (ps , "timekey_wait" , b .TimeKeyWait )
203190
204191 ps .InsertPairs ("tag" , b .Tag )
205192
206- if b .ChunkLimitSize != nil {
207- ps .InsertPairs ("chunk_limit_size" , * b .ChunkLimitSize )
208- }
209-
210- if b .ChunkLimitRecords != nil {
211- ps .InsertPairs ("chunk_limit_records" , * b .ChunkLimitRecords )
212- }
213-
214- if b .TotalLimitSize != nil {
215- ps .InsertPairs ("total_limit_size" , * b .TotalLimitSize )
216- }
217-
218- if b .QueueLimitLength != nil {
219- ps .InsertPairs ("queue_limit_length" , * b .QueueLimitLength )
220- }
221-
222- if b .QueuedChunksLimitSize != nil {
223- ps .InsertPairs ("queued_chunks_limit_size" , fmt .Sprint (* b .QueuedChunksLimitSize ))
224- }
225-
226- if b .Compress != nil {
227- ps .InsertPairs ("compress" , fmt .Sprint (* b .Compress ))
228- }
193+ params .InsertPairs (ps , "chunk_limit_size" , b .ChunkLimitSize )
194+ params .InsertPairs (ps , "chunk_limit_records" , b .ChunkLimitRecords )
195+ params .InsertPairs (ps , "total_limit_size" , b .TotalLimitSize )
196+ params .InsertPairs (ps , "queue_limit_length" , b .QueueLimitLength )
197+ params .InsertPairs (ps , "queued_chunks_limit_size" , b .QueuedChunksLimitSize )
198+ params .InsertPairs (ps , "compress" , b .Compress )
229199
230200 if b .FlushAtShutdown != nil && * b .FlushAtShutdown {
231201 ps .InsertPairs ("flush_at_shutdown" , fmt .Sprint (* b .FlushAtShutdown ))
232202 }
233203
234- if b .FlushMode != nil {
235- ps .InsertPairs ("flush_mode" , fmt .Sprint (* b .FlushMode ))
236- }
237-
238- if b .FlushInterval != nil {
239- ps .InsertPairs ("flush_interval" , fmt .Sprint (* b .FlushInterval ))
240- }
241-
242- if b .FlushThreadCount != nil {
243- ps .InsertPairs ("flush_thread_count" , fmt .Sprint (* b .FlushThreadCount ))
244- }
245-
246- if b .DelayedCommitTimeout != nil {
247- ps .InsertPairs ("delayed_commit_timeout" , fmt .Sprint (* b .DelayedCommitTimeout ))
248- }
249-
250- if b .OverflowAction != nil {
251- ps .InsertPairs ("overflow_action" , fmt .Sprint (* b .OverflowAction ))
252- }
253-
254- if b .RetryTimeout != nil {
255- ps .InsertPairs ("retry_timeout" , fmt .Sprint (* b .RetryTimeout ))
256- }
257-
258- if b .RetrySecondaryThreshold != nil {
259- ps .InsertPairs ("retry_secondary_threshold" , fmt .Sprint (* b .RetrySecondaryThreshold ))
260- }
261-
262- if b .RetryType != nil {
263- ps .InsertPairs ("retry_type" , fmt .Sprint (* b .RetryType ))
264- }
265-
266- if b .RetryMaxTimes != nil {
267- ps .InsertPairs ("retry_max_times" , fmt .Sprint (* b .RetryMaxTimes ))
268- }
269-
270- if b .RetryForever != nil {
271- ps .InsertPairs ("retry_forever" , fmt .Sprint (* b .RetryForever ))
272- }
273-
274- if b .RetryWait != nil {
275- ps .InsertPairs ("retry_wait" , fmt .Sprint (* b .RetryWait ))
276- }
277-
278- if b .RetryExponentialBackoffBase != nil {
279- ps .InsertPairs ("retry_exponential_backoff_base" , fmt .Sprint (* b .RetryExponentialBackoffBase ))
280- }
281-
282- if b .RetryMaxInterval != nil {
283- ps .InsertPairs ("retry_max_interval" , fmt .Sprint (* b .RetryMaxInterval ))
284- }
285-
286- if b .RetryRandomize != nil {
287- ps .InsertPairs ("retry_randomize" , fmt .Sprint (* b .RetryRandomize ))
288- }
289-
290- if b .DisableChunkBackup != nil {
291- ps .InsertPairs ("disable_chunk_backup" , fmt .Sprint (* b .DisableChunkBackup ))
292- }
204+ params .InsertPairs (ps , "flush_mode" , b .FlushMode )
205+ params .InsertPairs (ps , "flush_interval" , b .FlushInterval )
206+ params .InsertPairs (ps , "flush_thread_count" , b .FlushThreadCount )
207+ params .InsertPairs (ps , "delayed_commit_timeout" , b .DelayedCommitTimeout )
208+ params .InsertPairs (ps , "overflow_action" , b .OverflowAction )
209+ params .InsertPairs (ps , "retry_timeout" , b .RetryTimeout )
210+ params .InsertPairs (ps , "retry_secondary_threshold" , b .RetrySecondaryThreshold )
211+ params .InsertPairs (ps , "retry_type" , b .RetryType )
212+ params .InsertPairs (ps , "retry_max_times" , b .RetryMaxTimes )
213+ params .InsertPairs (ps , "retry_forever" , b .RetryForever )
214+ params .InsertPairs (ps , "retry_wait" , b .RetryWait )
215+ params .InsertPairs (ps , "retry_exponential_backoff_base" , b .RetryExponentialBackoffBase )
216+ params .InsertPairs (ps , "retry_max_interval" , b .RetryMaxInterval )
217+ params .InsertPairs (ps , "retry_randomize" , b .RetryRandomize )
218+ params .InsertPairs (ps , "disable_chunk_backup" , b .DisableChunkBackup )
293219
294220 if b .Time != nil {
295- if b .Time .TimeType != nil {
296- ps .InsertPairs ("time_type" , fmt .Sprint (* b .Time .TimeType ))
297- }
298- if b .Time .TimeFormat != nil {
299- ps .InsertPairs ("time_format" , fmt .Sprint (* b .Time .TimeFormat ))
300- }
301- if b .Time .Localtime != nil {
302- ps .InsertPairs ("localtime" , fmt .Sprint (* b .Time .Localtime ))
303- }
304- if b .Time .UTC != nil {
305- ps .InsertPairs ("utc" , fmt .Sprint (* b .Time .UTC ))
306- }
307- if b .Time .Timezone != nil {
308- ps .InsertPairs ("timezone" , fmt .Sprint (* b .Time .Timezone ))
309- }
310- if b .Time .TimeFormatFallbacks != nil {
311- ps .InsertPairs ("time_format_fallbacks" , fmt .Sprint (* b .Time .TimeFormatFallbacks ))
312- }
221+ params .InsertPairs (ps , "time_type" , b .Time .TimeType )
222+ params .InsertPairs (ps , "time_format" , b .Time .TimeFormat )
223+ params .InsertPairs (ps , "localtime" , b .Time .Localtime )
224+ params .InsertPairs (ps , "utc" , b .Time .UTC )
225+ params .InsertPairs (ps , "timezone" , b .Time .Timezone )
226+ params .InsertPairs (ps , "time_format_fallbacks" , b .Time .TimeFormatFallbacks )
313227 }
314228
315229 return ps , nil
0 commit comments