You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Over time I've seen a few questions on StackOverflow asking for a feature similar to what's being asked on serilog/serilog#1489 which is the ability to inspect the properties of the sinks configured, at run-time.
That feature is a bigger piece of work that requires design, of course, however in many of those questions, devs were aiming to use such a feature just to get a hold of the path of the file being written by this sink in particular, for different reasons (*).
I propose adding the log file path to the existing OnFileOpened hook, which would allow devs to plug in a hook that captures the file path of every log file written and keep track of the most recent one.
This would provide a workaround for this particular scenario until serilog/serilog#1489 or something similar becomes available.
Also, for consistency, the OnFileDeleting hook already exposes the file path, and I couldn't think of a reason why OnFileOpened wouldn't do the same.
(*) I can remember of a couple of examples where devs would like to know the exact file name (considering the name changes with rolling) in order to do run some activity:
I expected there to be some discussion and evolution once hooks hit the stable version and they became more visible, nice to see it happening 😄
The OnFileDeleting hook has the path of the file being deleted, and the scenarios given make sense - I don't know what you think @nblumhardt, but I'm in favour of this change 👍
Only thing I'd add is, to try to avoid churn: aside from filename, is there any other information that might be required? (I can't personally think of any)
Over time I've seen a few questions on StackOverflow asking for a feature similar to what's being asked on serilog/serilog#1489 which is the ability to inspect the properties of the sinks configured, at run-time.
That feature is a bigger piece of work that requires design, of course, however in many of those questions, devs were aiming to use such a feature just to get a hold of the path of the file being written by this sink in particular, for different reasons (*).
I propose adding the log file path to the existing
OnFileOpened
hook, which would allow devs to plug in a hook that captures the file path of every log file written and keep track of the most recent one.This would provide a workaround for this particular scenario until serilog/serilog#1489 or something similar becomes available.
Also, for consistency, the
OnFileDeleting
hook already exposes the file path, and I couldn't think of a reason whyOnFileOpened
wouldn't do the same.(*) I can remember of a couple of examples where devs would like to know the exact file name (considering the name changes with rolling) in order to do run some activity:
The text was updated successfully, but these errors were encountered: