in reply to How to create a bot code and log file??
It's easy enough to list information on a log file. You must first open the file, then when you get any information you want to log, you use the print command to write it to the log file. When you're done, then you close the log. Something like:
. . . Bot code # open the log file my $LogFileName = "log.text"; open my $LOG, '>', "/path/to/log/file/$LogFileName" or die "Eh? Can't create log: $!"; . . . more bot code here while (my $evt = get_next_event()) { print $LOG "Event type found: ", $evt->{EVT_TYPE}, "\n"; if ($evt->{EVT_TYPE} eq "SHUTDOWN") { print $LOG "Shutting down\n"; last; } elsif ($evt->{EVT_TYPE} eq "LIST_INFORMATION") { print $LOG "Information report:\n"; for my $k (%INFORMATION) { print $LOG " $k = '$INFORMATION{$k}\n"; } next; } elsif ( . . . process event } else { print $LOG "Eh? I didn't understand command $evt->{EVT_TYPE}! +\n"; } } close $LOG;
...roboticus
That is what he asked for, yes?
|
|---|