Skip to content

Zylatis/turnstiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Turnstiles

A WIP library which wraps the io::Write trait to enable file rotation i.e. for logs. The goal is to enable file rotation at the file handle level and do so with as few dependencies as possible.

Implemented/planned rotation conditions:

  • None (never rotate)
  • SizeMB (file size)
  • Duration (time since last modified)
  • SizeLines (number of lines in file)

There are also three options to prune old logs:

  • None
  • MaxFiles
  • MaxAge

Warning:

This is currently in active development and may change/break often. Every effort will be taken to ensure that breaking changes that occur are reflected in a change of at least the minor version of the package, both in terms of the API and the generation of log files. Versions prior to 0.2.0 were so riddled with bugs I'm amazed I managed to put my pants on on those days I was writing it.

Documentation

See docs here for notes on how it works, example usage, and error handling.

Future work

  • Refresh internal index when rotation requested, not just at logger creation
  • Be more careful around edgecases for example rotating on 1mb files and writing exactly 1mb to disk
  • More direct integration with dedicated logging libraries, i.e. impl log::Log.
  • Investigate integration with things like atomicwrites
  • More flexible rotation options

Why turnstiles?

It's a metal thing that rotates, and also the name of the Billy Joel album which has Summer, Highland Falls on it, one of my favourite songs.