Changeset

4219:b3dd77f2d0d7

mod_log_ringbuffer: Switch `filename` to not be interpolated, add filename_template which is
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Oct 2020 18:41:15 +0100
parents 4218:f917bb78ab67
children 4220:0b1b7d671448
files mod_log_ringbuffer/README.markdown mod_log_ringbuffer/mod_log_ringbuffer.lua
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_log_ringbuffer/README.markdown	Fri Oct 16 18:40:29 2020 +0100
+++ b/mod_log_ringbuffer/README.markdown	Fri Oct 16 18:41:15 2020 +0100
@@ -51,8 +51,11 @@
     old data will be overwritten by new data.
 
 `filename`
-:   The name of the file to dump logs to when triggered. The filename may
-    contain a number of variables, described below. Defaults to
+:   The name of the file to dump logs to when triggered.
+
+`filename_template`
+:   This parameter may optionally be specified instead of `filename. It
+    may contain a number of variables, described below. Defaults to
     `"{paths.data}/ringbuffer-logs-{pid}-{count}.log"`.
 
 Only one of the following triggers may be specified:
@@ -68,6 +71,9 @@
 
 ## Filename variables
 
+If `filename_template` is specified instead of `filename`, it may contain
+any of the following variables in curly braces, e.g. `{pid}`.
+
 `pid`
 :   The PID of the current process
 
--- a/mod_log_ringbuffer/mod_log_ringbuffer.lua	Fri Oct 16 18:40:29 2020 +0100
+++ b/mod_log_ringbuffer/mod_log_ringbuffer.lua	Fri Oct 16 18:41:15 2020 +0100
@@ -68,7 +68,7 @@
 	end
 
 	local function dump()
-		dump_buffer(buffer, get_filename(sink_config.filename));
+		dump_buffer(buffer, sink_config.filename or get_filename(sink_config.filename_template));
 	end
 
 	if sink_config.signal then