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]> |
Gets my vote, would you like me to create a pull?
Giles
On 12/01/2021 19:03, Jeff Siddall via misterhouse-users wrote:
> Replying to my own post, would a user defined function be the
> quick/easy way to handle log handling customization?
>
> Ex: the first thing in the handle_log sub would be a call to a user
> handling function, sort of like a pre-defined hook:
>
> sub handle_log {
> ...
> my @returned_log = &handle_log_user($message, $severity,
> $category) if (defined(&handle_log_user));
> # Check for any updated values in @return_log
> ...
> }
>
> Then if a user wanted to add their own custom handler they would just
> put something like this in their user code:
>
> sub handle_log_user {
> my ($message, $severity, $category) = @_;
> if ($message =~ /WARN*.temperature/ ) {
> $severity = "ALERT";
> }
> return ($message, $severity, $category);
> }
>
> Otherwise they get the default behavior. I think MH will even pull
> subs out of user code so this should work without further modification
>
> A few lines of code but complete flexibility. That doesn't seem too
> geeky for a MH user ambitious enough to want to customize their log
> handling.
>
> Jeff
>
>
>
> ________________________________________________________
> 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