Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to create symlink #80

Open
zhongshanxian opened this issue Mar 1, 2022 · 3 comments
Open

how to create symlink #80

zhongshanxian opened this issue Mar 1, 2022 · 3 comments
Assignees

Comments

@zhongshanxian
Copy link

zhongshanxian commented Mar 1, 2022

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
});

@iccicci iccicci self-assigned this Mar 1, 2022
@iccicci
Copy link
Owner

iccicci commented Mar 1, 2022

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

@zhongshanxian
Copy link
Author

zhongshanxian commented Mar 2, 2022

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?

@iccicci
Copy link
Owner

iccicci commented Mar 2, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants