@@ -18,12 +18,11 @@ status](https://www.r-pkg.org/badges/version/rotor)](https://cran.r-project.org/
1818** rotor** provides a cross platform R reimagination of
1919[ logrotate] ( https://linux.die.net/man/8/logrotate ) . It is a companion
2020package to the logging package [ lgr] ( https://github.com/s-fleck/lgr ) . In
21- addition to rotating log files, it can also be used as a (primitive)
22- backup tool. For conditionally creating and deleting backups, rotor
23- relies solely on information encoded in a suffix of the backup file
24- names (i.e. a timestamp or index). It therefore also works with backups
25- created by other tools, as long as the filename has a format that rotor
26- can understand.
21+ contrast to logrotate, rotor relies solely on information encoded in a
22+ suffixes of file names for conditionally creating backups (i.e. a
23+ timestamp or index). It therefore also works with backups created by
24+ other tools, as long as the filename has a format that rotor can
25+ understand.
2726
2827` rotate() ` , ` rotate_date() ` , and ` rotate_time() ` move a file and insert
2928a suffix (either an integer or a timestamp) into the filename. In
@@ -80,8 +79,8 @@ backup(tf, compression = TRUE)
8079
8180# display backups of a file
8281list_backups(tf )
83- # > [1] "/tmp/RtmplvAoSn /rotor/mylogfile.1.log.zip"
84- # > [2] "/tmp/RtmplvAoSn /rotor/mylogfile.2.log"
82+ # > [1] "/tmp/RtmplU947x /rotor/mylogfile.1.log.zip"
83+ # > [2] "/tmp/RtmplU947x /rotor/mylogfile.2.log"
8584```
8685
8786` rotate() ` also backs up a file, but replaces the original file with an
@@ -90,9 +89,9 @@ empty one.
9089``` r
9190rotate(tf )
9291list_backups(tf )
93- # > [1] "/tmp/RtmplvAoSn /rotor/mylogfile.1.log"
94- # > [2] "/tmp/RtmplvAoSn /rotor/mylogfile.2.log.zip"
95- # > [3] "/tmp/RtmplvAoSn /rotor/mylogfile.3.log"
92+ # > [1] "/tmp/RtmplU947x /rotor/mylogfile.1.log"
93+ # > [2] "/tmp/RtmplU947x /rotor/mylogfile.2.log.zip"
94+ # > [3] "/tmp/RtmplU947x /rotor/mylogfile.3.log"
9695
9796# the original file is now empty
9897readLines(tf )
@@ -115,10 +114,10 @@ backup(tf, max_backups = 4)
115114backup(tf , max_backups = 4 )
116115
117116list_backups(tf )
118- # > [1] "/tmp/RtmplvAoSn /rotor/mylogfile.1.log"
119- # > [2] "/tmp/RtmplvAoSn /rotor/mylogfile.2.log"
120- # > [3] "/tmp/RtmplvAoSn /rotor/mylogfile.3.log"
121- # > [4] "/tmp/RtmplvAoSn /rotor/mylogfile.4.log.zip"
117+ # > [1] "/tmp/RtmplU947x /rotor/mylogfile.1.log"
118+ # > [2] "/tmp/RtmplU947x /rotor/mylogfile.2.log"
119+ # > [3] "/tmp/RtmplU947x /rotor/mylogfile.3.log"
120+ # > [4] "/tmp/RtmplU947x /rotor/mylogfile.4.log.zip"
122121```
123122
124123We can also use ` prune_backups() ` to delete old backups. Other than
@@ -137,8 +136,8 @@ timestamped backups.
137136backup_date(tf )
138137rotate_time(tf )
139138list_backups(tf )
140- # > [1] "/tmp/RtmplvAoSn /rotor/mylogfile.2019-05-16--14-47 -44.log"
141- # > [2] "/tmp/RtmplvAoSn /rotor/mylogfile.2019-05-16 .log"
139+ # > [1] "/tmp/RtmplU947x /rotor/mylogfile.2019-05-28--07-51 -44.log"
140+ # > [2] "/tmp/RtmplU947x /rotor/mylogfile.2019-05-28 .log"
142141```
143142
144143``` r
0 commit comments