Jaymon / testdata

Python module to make testing easier, it can generate random data like names and text, run commands, fetch urls, create files and directories, and more
MIT License
10 stars 0 forks source link

Service could take a file path and read from the file #60

Closed Jaymon closed 4 years ago

Jaymon commented 4 years ago

the idea being that you would start the service, but then give it a file path and it would tail that file in another thread and dump its contents to the screen, or at least allow access to the content.

This comes up because we start something, but it is a service that writes to a logfile, so if you want to see why the request to the service failed, you have to open another shell and go tail its log file, which is annoying.

Jaymon commented 4 years ago

I need a testdata.stream("/path/to/logfile") and it will tail that file and just print everything to stdout that gets put into the file.

Jaymon commented 4 years ago

You could solve this using Command:

c = Command("tail -n 0 -f /path/to/file")
c.run_async()
Jaymon commented 4 years ago

Something I didn't think of: permissions

the ideal way to do this for any higher level log files is probably something like:

Command("sudo tail -n 0 -f /var/log/syslog", logger_prefix="").run_async()