diff --git a/Anvil/Tools/Email.pm b/Anvil/Tools/Email.pm index a89ea657..035e3942 100644 --- a/Anvil/Tools/Email.pm +++ b/Anvil/Tools/Email.pm @@ -467,15 +467,16 @@ sub send_alerts { # The user wants it. my $message = $anvil->Words->parse_banged_string({ + debug => $debug, language => $recipient_language, key_string => $alert_message, - }); + # A lot of multi-line strings start with an opening new line. This removes that. $message =~ s/^\n//; $message =~ s/\n$//s; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { message => $message }}); + if ($alert_title) { my $title = "[ ".$alert_set_by." ] ".$anvil->Words->parse_banged_string({ diff --git a/Anvil/Tools/Words.pm b/Anvil/Tools/Words.pm index 18ddd876..5c5710d3 100644 --- a/Anvil/Tools/Words.pm +++ b/Anvil/Tools/Words.pm @@ -343,16 +343,19 @@ sub load_agent_strings foreach my $agent_name (sort {$a cmp $b} keys %{$anvil->data->{scancore}{agent}}) { my $agent_words = $anvil->data->{scancore}{agent}{$agent_name}.".xml"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { agent_words => $agent_words }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { agent_words => $agent_words }}); if ((-e $agent_words) && (-r $agent_words)) { # Read the words file. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0251", variables => { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0251", variables => { agent_name => $agent_name, file => $agent_words, }}); - $anvil->Words->read({file => $agent_words}); + $anvil->Words->read({ + debug => $debug, + file => $agent_words, + }); } } @@ -447,6 +450,12 @@ sub parse_banged_string $new_string =~ s/\n$//; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { new_string => $new_string }}); } + else + { + # If a string doesn't have a new-line, then copy the key string directly. + $new_string = $key_string; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { new_string => $new_string }}); + } # There might be multiple keys, split by newlines. foreach my $message (split/\n/, $new_string)