Re: [mh] Your help re Genericising Error and log handling
Giles Godart-Brown <[email protected]>
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <[email protected]> |
It would be easy to use what I'm proposing in pull #820 to implement this using any of the techniques described. You would probably want to regex the current messages in your print_log_private() to decide on a suitable category. G On 14/01/2021 13:04, Richard F wrote: > Yes - the Linux shell command is "logger", and it takes some params > like so > > logger -s -p "$log_facility.$crit" -t <program or service name> <message> > > The severity is as you list for "severity", which is why I assumed you > were working to this scheme. The "facility" should be chosen/set by > the user. Maybe local1, local2..local7, That makes it easier to filter. > > More here: https://man7.org/linux/man-pages/man1/logger.1.html > > One can pipe messages to loggers (syslog/rsyslog/syslog-ng) through a > socket without invoking a separate program, that has the advantage of > the option to send log info remotely or "centrally" if anyone is > minded to, and doubtless more efficient (if it were high volume). If > already in a compatible format, may be a good route for MH core. I > haven't tried to pipe to syslog, only listen, but I pipe messages to > Zoneminder this way on the local machine and LIRC on a remote pi, MH > pipes to festival and various other things, it's perfectly reliable. > > Examples: I capture my router syslog and bung it in 1 place on the > server so I can keep an eye on it. It's also fairly easy to trap > syslog messages - an MH real-world example: I trap VDR "program > running" messages from syslog to switch my TV exactly when a program > starts, not relying on advertised schedule which may be several mins > out. (this uses an MH "socket item" to talk to the TV while listening > to a syslog-ng socket for the appropriate message). > > I'm wary of reinventing a wheel here, this stuff is established with > debugged tools and interfaces. If adding to the simplistic built-in > MH scheme, to me it seems sensible to leverage this, which has been a > missing feature. > > BTW there's some existing code that implements the "logger" call in > Lynx10PLC.pm. Also some code to monitor syslog output in > monitor_router.pl > > HTH Richard > > > On 13/01/2021 1:56 pm, Giles Godart-Brown wrote: >> >> Thanks for the input Richard. >> >> Print_log_simple (the old print_log) calls logit, so I think I've >> preserved backwards compatibility (its been running all day so far). >> >> As for integrating with other tools, once we have allowed a >> developer to grab the print_log messages before they are sent to >> disk, the world is their oyster, do you have some Linux hooks we >> could put into an example? >> >> > > > ________________________________________________________ > To unsubscribe from this list, go to: > https://lists.sourceforge.net/lists/listinfo/misterhouse-users > ________________________________________________________ To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users