Gathering detailed insights and metrics for @abtnode/winston-daily-rotate-file
Gathering detailed insights and metrics for @abtnode/winston-daily-rotate-file
Gathering detailed insights and metrics for @abtnode/winston-daily-rotate-file
Gathering detailed insights and metrics for @abtnode/winston-daily-rotate-file
npm install @abtnode/winston-daily-rotate-file
62.9
Supply Chain
96.8
Quality
79.3
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
899 Stars
248 Commits
156 Forks
24 Watching
2 Branches
47 Contributors
Updated on 21 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-25.5%
309
Compared to previous day
Last week
106.4%
2,429
Compared to previous week
Last month
41.6%
8,350
Compared to previous month
Last year
0%
34,588
Compared to previous year
1
A transport for winston which logs to a rotating file. Logs can be rotated based on a date, size limit, and old logs can be removed based on count or elapsed days.
Starting with version 2.0.0, the transport has been refactored to leverage the file-stream-rotator module. Some of the options in the 1.x versions of the transport have changed. Please review the options below to identify any changes needed.
Please note that if you are using winston@2
, you will need to use winston-daily-rotate-file@3
. winston-daily-rotate-file@4
removed support for winston@2
.
Starting with version 5.0.0 this module also emits an "error" event for all low level filesystem error cases. Make sure to listen for this event to prevent crashes in your application.
This library should work starting with Node.js 8.x, but tests are only executed for Node.js 14+. Use on your own risk in lower Node.js versions.
npm install winston-daily-rotate-file
The DailyRotateFile transport can rotate files by minute, hour, day, month, year or weekday. In addition to the options accepted by the logger, winston-daily-rotate-file
also accepts the following options:
datePattern
for the rotation times. (default: null)%DATE%
placeholder which will include the formatted datePattern at that point in the filename. (default: 'winston.log.%DATE%'){ flags: 'a' }
)audit_file
. If not specified, a file name is generated that includes a hash computed from the options object, and uses the dirname
option value as the directory. (default: <dirname>/.<optionsHash>-audit.json
)createLogger
method will be used1 var winston = require('winston'); 2 require('winston-daily-rotate-file'); 3 4 var transport = new winston.transports.DailyRotateFile({ 5 level: 'info', 6 filename: 'application-%DATE%.log', 7 datePattern: 'YYYY-MM-DD-HH', 8 zippedArchive: true, 9 maxSize: '20m', 10 maxFiles: '14d' 11 }); 12 13 transport.on('error', error => { 14 // log or handle errors here 15 }); 16 17 transport.on('rotate', (oldFilename, newFilename) => { 18 // do something fun 19 }); 20 21 var logger = winston.createLogger({ 22 transports: [ 23 transport 24 ] 25 }); 26 27 logger.info('Hello World!'); 28
using multiple transports
1 var winston = require('winston'); 2 require('winston-daily-rotate-file'); 3 4 var transport1 = new winston.transports.DailyRotateFile({ 5 filename: 'application-%DATE%.log', 6 datePattern: 'YYYY-MM-DD-HH', 7 zippedArchive: true, 8 maxSize: '20m', 9 maxFiles: '14d' 10 }); 11 12 var transport2 = new winston.transports.DailyRotateFile({ 13 level: 'error', 14 filename: 'application-error-%DATE%.log', 15 datePattern: 'YYYY-MM-DD-HH', 16 zippedArchive: true, 17 maxSize: '20m', 18 maxFiles: '14d' 19 }); 20 21 transport1.on('error', error => { 22 // log or handle errors here 23 }); 24 25 transport2.on('error', error => { 26 // log or handle errors here 27 }); 28 29 transport1.on('rotate', function(oldFilename, newFilename) { 30 // do something fun 31 }); 32 33 transport2.on('rotate', function(oldFilename, newFilename) { 34 // do something fun 35 }); 36 37 var logger = winston.createLogger({ 38 level: 'info' 39 transports: [ 40 transport1, // will be used on info level 41 transport2 // will be used on error level 42 ] 43 }); 44 45 logger.info('Hello World!'); 46 logger.error('Hello Error!'); 47
1import * as winston from 'winston'; 2import 'winston-daily-rotate-file'; 3 4 5const transport = new winston.transports.DailyRotateFile({ 6 filename: 'application-%DATE%.log', 7 datePattern: 'YYYY-MM-DD-HH', 8 zippedArchive: true, 9 maxSize: '20m', 10 maxFiles: '14d' 11}); 12 13transport.on('error', error => { 14 // log or handle errors here 15}); 16 17transport.on('rotate', (oldFilename, newFilename) => { 18 // do something fun 19}); 20 21const logger = winston.createLogger({ 22 transports: [ 23 transport 24 ] 25}); 26 27logger.info('Hello World!');
1 2import * as winston from 'winston'; 3import DailyRotateFile from 'winston-daily-rotate-file'; 4 5const transport: DailyRotateFile = new DailyRotateFile({ 6 filename: 'application-%DATE%.log', 7 datePattern: 'YYYY-MM-DD-HH', 8 zippedArchive: true, 9 maxSize: '20m', 10 maxFiles: '14d' 11}); 12 13transport.on('error', error => { 14 // log or handle errors here 15}); 16 17 18transport.on('rotate', (oldFilename, newFilename) => { 19 // do something fun 20}); 21 22const logger = winston.createLogger({ 23 transports: [ 24 transport 25 ] 26}); 27 28logger.info('Hello World!');
This transport emits the following custom events:
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
6 existing vulnerabilities detected
Details
Reason
Found 7/20 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More