Skip to content

Implement automatic log rotation#21

Open
psolymos wants to merge 10 commits intoryapric:mainfrom
psolymos:main
Open

Implement automatic log rotation#21
psolymos wants to merge 10 commits intoryapric:mainfrom
psolymos:main

Conversation

@psolymos
Copy link

This PR addresses #20 and fixes an issue when nrow(log_df) - rotate_lines + 1 leads to negative row index.

This can happen when rotate_lines > nrow(log_df)

Signed-off-by: Peter Solymos <psolymos@gmail.com>
Signed-off-by: Peter Solymos <psolymos@gmail.com>
Signed-off-by: Peter Solymos <psolymos@gmail.com>
Signed-off-by: Peter Solymos <psolymos@gmail.com>
Signed-off-by: Peter Solymos <psolymos@gmail.com>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think given the naming convention of the function itself (set_rotate_lines() vs. e.g. set_rotation_on()), this should default to NULL instead of an integer, since it expects an integer. Might need a check in rotate_logs() as well if NULL is passed in, so it doesn't crash.

@ryapric
Copy link
Owner

ryapric commented Apr 12, 2022

Thank you, looks pretty good! Could you also add some tests to confirm functionality?

@psolymos
Copy link
Author

@ryapric I addressed the comments. Let me know what you think.

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

Successfully merging this pull request may close these issues.

Add rotate_lines to .config and rotate logs automatically

2 participants

Comments