ryapric / loggit

Modern Logging for the R Ecosystem
Other
37 stars 2 forks source link

Feature request: read_logs() from URL #16

Closed maia-sh closed 3 years ago

maia-sh commented 3 years ago

Thank you for this great logging package, and for considering this feature request!

It would be great to be able to read a remote log file from a URL, instead of a local filepath, e.g., queries <- read_logs("https://raw.githubusercontent.com/USER/REPO/main/queries.log")

ryapric commented 3 years ago

Thanks for using it, and for the suggestion!

This kind of feature is something I'd consider as being out-of-scope for loggit, since a specific design goal is to be as lightweight as possible. There are a lot of moving parts to consider besides "point at a remote log file": what if the log file is protected by auth? What if the fetch fails; how should loggit behave? What if the remote format isn't parseable? Some concerns could be mitigated by adding a dependency or two to loggit's requirements, but loggit is designed to have zero external dependencies.

So, this is functionality that I would rather delegate to the user. In your provided example, something like the following should work:

> download.file("http://path-to-remote-log-file", "/tmp/my-logfile.log")
> loggit::read_logs("/tmp/my-logfile.log")

Which you could also wrap into your own function.

maia-sh commented 3 years ago

Thanks so much for addressing this comment and your thoughtful explanation! This makes total sense, and I have indeed been using a wrapper function just like that.