-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Feature Request] Event handlers for FileSink
and RotatingFileSink
#53
Comments
I don't think this is necessary since you can change the path via |
But for I'm thinking if there are any cons to doing it this way. |
The reason I feel a bit strange is that if you give your user a pub trait RotateFileOpener {
fn open(&self /*, other params */) -> PathBuf;
}
impl<ArgBP, ArgRP> RotateFileSinkBuilder<ArgBP, ArgRP> {
pub fn opener(self, opener: Box<dyn RotateFileOpener>) -> Self {
todo!()
}
} The hook can be kept (and it should be kept). It's purpose is to give the user a change to do monitoring and bookkeeping jobs. But I still don't think changing the filename from the hook is a good idea. We have other approaches to express the indent more clearly. |
Makes sense. So let's keep The new trait So the current signatures of the event handlers will be before_file_open : impl Fn(path: &Path)
after_file_open : impl Fn(path: &Path, file: &mut File)
before_file_close : impl Fn(path: &Path, file: &mut File)
after_file_close : impl Fn(path: &Path) Is it right? |
What's the purpose of the |
Implement event handlers (reference from C++ spdlog) for
FileSink
andRotatingFileSink
by adding new methods on the builders of these file sinks.The names of these methods are tentatively designated as
before_file_open
,after_file_open
,before_file_close
andafter_file_close
.Unsolved questions:
&mut PathBuf
tobefore_file_open
handler to allow users to change the file path?The text was updated successfully, but these errors were encountered: