use strict;

sub dolog {
	my $file = shift;
	if(!defined($file)) { $file = "controller.log";}
	my $message = shift;
	if(!defined($message)) { $message = "unknown error";}
	my $mode = shift;
	if(!defined($mode)) { $mode = ">";}
	my $sec; my $min; my $hour; my $mday; my $mon; my $year; my $wday; my $yday; my $isdst;
	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
	open(LOGFILE,"$mode $file");
	printf LOGFILE "%4d-%02d-%02d %02d:%02d:%02d\n",$year+1900,$mon+1,$mday,$hour,$min,$sec;
	print LOGFILE $message . "\n";
	close(LOGFILE);
}

1;