Skip to content

Commit ebd52ac

Browse files
author
Matt Berther
committed
add auditFile option to override component generated audit file name
1 parent 45bb5a3 commit ebd52ac

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The DailyRotateFile transport can rotate files by minute, hour, day, month, year
2323
* **maxSize:** Maximum size of the file after which it will rotate. This can be a number of bytes, or units of kb, mb, and gb. If using the units, add 'k', 'm', or 'g' as the suffix. The units need to directly follow the number. (default: null)
2424
* **maxFiles:** Maximum number of logs to keep. If not set, no logs will be removed. This can be a number of files or number of days. If using days, add 'd' as the suffix. (default: null)
2525
* **options:** An object resembling https://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options indicating additional options that should be passed to the file stream. (default: `{ flags: 'a' }`)
26+
* **auditFile**: A string representing the name of the name of the audit file. This can be used to override the default filename which is generated by computing a hash of the options object. (default: '.<optionsHash>.json')
2627

2728
## Usage
2829
``` js

daily-rotate-file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ var DailyRotateFile = function (options) {
8787
size: getMaxSize(options.maxSize),
8888
max_logs: options.maxFiles,
8989
end_stream: true,
90-
audit_file: path.join(self.dirname, '.' + hash(options) + '-audit.json'),
90+
audit_file: options.auditFile ? options.auditFile : path.join(self.dirname, '.' + hash(options) + '-audit.json'),
9191
file_options: options.options ? options.options : {flags: 'a'}
9292
});
9393

0 commit comments

Comments
 (0)