- my $hash = get_hashname($ref);
- if (!open(AP,">>db-h/$hash/$ref.log")) {
- print {$debugfh} "failed open log<\n";
- print {$debugfh} "failed open log err $!<\n";
- die "opening db-h/$hash/$ref.log (li): $!";
- }
- print(AP "\7\n",escape_log($msg),"\n\3\n") || die "writing db-h/$hash/$ref.log (li): $!";
- close(AP) || die "closing db-h/$hash/$ref.log (li): $!";
+ my ($ref,$msg) = @_;
+ my $log_location = buglog($ref);
+ die "Unable to find .log for $ref"
+ if not defined $log_location;
+ my $logfh = IO::File->new(">>$log_location") or
+ die "Unable to open $log_location for appending: $!";
+ write_log_records(logfh => $logfh,
+ records => [{type => 'incoming-recv',
+ text => $msg,
+ }]);
+ close ($logfh) or die "Unable to close $log_location: $!";