sub write_log { my $my_func_id = "write_log"; print "$my_func_id EVENT_LEVEL: $log{'event_level'}\n" if ($debug eq "1"); print "$my_func_id LABEL_ID: $label_id\n" if ($debug eq "1"); print "$my_func_id ROLE_ID: $log{'role_id'}\n" if ($debug eq "1"); print "$my_func_id FUNC_ID: $log{'func_id'}\n" if ($debug eq "1"); print "$my_func_id MESSAGE: $log{'message'}\n" if ($debug eq "1"); my $do_write_log = "INSERT INTO `$log_tbl` (`event_id`, `event_level`, `label_id`, `role_id`, `func_id`, `message`, `event_date`) VALUES (NULL, '$log{'event_level'}', '$label_id', '$log{'role_id'}', '$log{'func_id'}', '$log{'message'}', CURRENT_TIMESTAMP);"; print "$my_func_id QUERY: $do_write_log\n" if ($debug eq "1"); my $sth0 = $dbh->prepare($do_write_log); $sth0->execute(); $sth0->finish(); }