lopter / lightsd

A daemon with a JSON-RPC API to control your light bulbs
GNU General Public License v3.0
129 stars 15 forks source link

Feature Request: Logfile support #1

Closed sjcliffe closed 9 years ago

sjcliffe commented 9 years ago

I tried running lightsd with stderr redirected to a log file which works fine in the foreground but not in the background (-d) as it seems to close the stdio file descriptors. Would it be possible to add support via the command line to specify a log file location?

Thanks & great work!

lopter commented 9 years ago

Yes, I can see how that would be useful!

This shouldn't be too hard, I also had the idea of supporting syslog that might even be a better solution, what do you think?

sjcliffe commented 9 years ago

Syslog would work. If you provide the ability to specify a facility then the syslog config can be used to direct it to a specific file.

lopter commented 9 years ago

Cool, I'll look into that then!

lopter commented 9 years ago

Hey @sjcliffe, I just wanted to say that I probably won't do that before early October, depending on your use case Supervisor might be a temporary solution, it's an easy solution. It's packaged on most system otherwise it can be installed in a Python virtualenv.

sjcliffe commented 9 years ago

No problem @lopter - not really an issue, more of a nice to have in future.

lopter commented 9 years ago

@sjcliffe here is a patch that adds syslog supports to lightsd, in case you wanna try it.

It seems to be working fine on Linux/BSD, logs didn't show up on OS X Yosemite, but I don't see why it wouldn't work, I'm too lazy to dig into the OS X settings.

I should release that soon, with packaging for OpenWRT and dpkg, before I start working on GH-5.