rotating-file-stream icon indicating copy to clipboard operation
rotating-file-stream copied to clipboard

how to create symlink

Open zhongshanxian opened this issue 2 years ago • 3 comments

i use rotating-file-stream to rotate log. After rotate, test.json.log will empty. now I need that test.json.log save 7d log data, how can i do? like winston.transports.DailyRotateFile createSymlink and symlinkName

const rotatingFileStream = require('rotating-file-stream'); const { createStream } = rotatingFileStream;

const pad = (num) => (num > 9 ? '' : '0') + num; const generator = (time) => { if (!time) return 'test.json.log'; const year = time.getFullYear(); const month = pad(time.getMonth() + 1); const day = pad(time.getDate()); return test-${year}-${month}-${day}.json.log; };

const stream = createStream(generator, { path: './', // Specifies the base path for files interval: '1d', // Specifies the time interval to rotate the file maxSize: '200M', // Specifies the maximum size of rotated files to keep maxFiles: 7 // Specifies the maximum number of rotated files to keep });

zhongshanxian avatar Mar 01 '22 12:03 zhongshanxian

Hi @zhongshanxian ,

ATM there is no option to create a symlink; I could take the occasion to add this feature, but in this period I'm so busy, it's possible I'm not able to start working on it in the next two weeks.

I'm sorry I'm not sure I got the point of the first two lines of the request; could it be that interval: '7d' is what you are looking for? If that's not the case, please feel free to ask.

iCC

iccicci avatar Mar 01 '22 18:03 iccicci

emmmm, I had hoped not to empty the test.json.log after rotating. And provide an option to specifies the maximum days of test.json.log to keep. I'd like to confirm that test.json.log similar winston.transports.DailyRotateFile createSymlink and symlinkName?

zhongshanxian avatar Mar 02 '22 03:03 zhongshanxian

No sorry, at the moment there are not option to behave like that.

I can add this in the todo list, but as I said it will not be added soon.

Hope this helps, iCC

iccicci avatar Mar 02 '22 11:03 iccicci