Commit f0e25137 authored by Leigh B Stoller's avatar Leigh B Stoller

Add CreateFromString($$$);

parent 7c9224f1
......@@ -166,6 +166,30 @@ sub Create($$;$)
return Logfile->Lookup($logid);
}
#
# Create from a string.
#
sub CreateFromString($$$)
{
my ($class, $group, $string) = @_;
my $logfile = Logfile->Create($group);
return undef
if (!defined($logfile));
my $filename = $logfile->filename();
if (open(LOG, ">$filename")) {
print LOG $string;
close(LOG);
}
else {
print STDERR "Logfile::CreateFromString: Cannot write to $filename\n";
$logfile->Delete(1);
return undef;
}
return $logfile;
}
#
# Delete a logfile record. Optionally delete the logfile too.
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment