logging better
This commit is contained in:
parent
d1d0157bc5
commit
415451a8fb
@ -39,7 +39,7 @@ sub handle($$) {
|
||||
};
|
||||
|
||||
if ($data) {
|
||||
# _debug( "[$topic] " . summary($data) );
|
||||
_debug( "[$topic] " . summary($data) );
|
||||
foreach (@{$data}) {
|
||||
process_message($_);
|
||||
}
|
||||
@ -66,13 +66,13 @@ sub process_message($) {
|
||||
clear_berth($inner{area_id}, $inner{from});
|
||||
set_berth($inner{area_id}, $inner{to}, $inner{descr});
|
||||
|
||||
# "STEP: $inner{area_id} $inner{to} := $inner{descr} at $inner{time}\n";
|
||||
_debug( "STEP: $inner{area_id} $inner{to} := $inner{descr} at $inner{time}" );
|
||||
} elsif($type eq 'CB_MSG') {
|
||||
clear_berth($inner{area_id}, $inner{from});
|
||||
# "CLEAR: $inner{area_id} $inner{from} at $inner{time}\n";
|
||||
_debug( "CLEAR: $inner{area_id} $inner{from} at $inner{time}" );
|
||||
} elsif($type eq 'CC_MSG') {
|
||||
set_berth($inner{area_id}, $inner{to}, $inner{descr});
|
||||
# "INTERPOSE: $inner{area_id} $inner{to} := $inner{descr} at $inner{time}\n";
|
||||
_debug( "INTERPOSE: $inner{area_id} $inner{to} := $inner{descr} at $inner{time}" );
|
||||
} else {
|
||||
# print "SKIPPING MESSAGE\n";
|
||||
}
|
||||
@ -112,8 +112,10 @@ $mqtt = Net::MQTT::Simple->new($ENV{MQTT_SERVER}) or die "Failed to connect to m
|
||||
$mqtt->subscribe(
|
||||
"$ENV{MQTT_MONITOR}" => sub {
|
||||
my ($topic, $message) = @_;
|
||||
_debug("--> $topic");
|
||||
handle($topic, $message);
|
||||
},
|
||||
);
|
||||
_debug("Ready to receive messages");
|
||||
|
||||
$mqtt->run();
|
||||
$mqtt->run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user