wouterdebie / locast2tuner

Locast to Emby/Plex/Channels server
https://wouterdebie.github.io/locast2tuner/
MIT License
52 stars 8 forks source link

Add option to force timestamps when logging #31

Closed Croq360 closed 3 years ago

Croq360 commented 3 years ago

Currently, the logging I'm getting doesn't appear to have any timestamps. It would be helpful to have that so if something goes wrong, you know when it happened, and also, to be able to look at it and see that you have recent entries.

Croq360 commented 3 years ago

This is an enhancement request, but I can't figure out how to flag it as such.

wouterdebie commented 3 years ago

What locast2tuner (and locast2dvr as well) does is that if you start it from the command line and have a terminal (or tty in UNIX), it will display the timestamp. If it doesn't have a tty (because it's piped to another process, or the output is handled by syslog), it will remove the timestamp, because otherwise the timestamp will be in the log file twice. I could add an option to always show the timestamp.

Croq360 commented 3 years ago

Yeah, something like that would be good. I tried to set the logging in WinSW (that I'm using to run locast2tuner as a service) to do the timestamps, but it doesn't appear to be capable of adding them. Interestingly, what WinSW seems to be doing is to redirect any STDERR and STDOUT to respective log files (though basically everything seems to be going to the ERR logfile, not a big deal just interesting), but however it's doing things, the timestamps are not getting into the logs.

I noticed the same thing when I tried to use "tee" running from a command line to mirror STDOUT/STDERR to a file, and no timestamps wound up in those files either.

wouterdebie commented 3 years ago

Interesting.. I'll add the option!