Skip to content
ggodart edited this page Dec 31, 2020 · 6 revisions

Hints and tips

Logging

Ìn order to be able to turn logging on and off without restarting MisterHouse, define a generic item GENERIC, logging_level, Variable in items.mht and create a new logger e.g.

#-----------------------------------------------------------------------
# write_log (text)
# writes a log message when logging_level > 0
#-----------------------------------------------------------------------
sub write_log {
	my $message = $_[0];
	if ( $logging_level->{state} > 0 ) {
		print_log($message);
	}
	return;
}

Then use write_log(zzz) instead of print_log(zzz) and it will only fill your log when logging_level > 0

Clone this wiki locally