nomoney: add logging
This commit is contained in:
parent
bfb2d712e7
commit
fab19ba6d0
2 changed files with 16 additions and 6 deletions
|
@ -22,23 +22,33 @@ sub _inform($unresolved, $username, $skip_print = 0) {
|
||||||
call_hooks("beep");
|
call_hooks("beep");
|
||||||
|
|
||||||
say "Not possible:";
|
say "Not possible:";
|
||||||
|
|
||||||
for my $entry ($unresolved->entries) {
|
for my $entry ($unresolved->entries) {
|
||||||
unless ($skip_print) {
|
unless ($skip_print) {
|
||||||
my @printable = $entry->as_printable;
|
my $line = ($entry->as_printable)[0];
|
||||||
print $printable[0], "\n";
|
say $line;
|
||||||
|
|
||||||
|
$line =~ s/^\s+//;
|
||||||
|
call_hooks("log_info", "nomoney: $line");
|
||||||
}
|
}
|
||||||
|
|
||||||
my $broke_users = $entry->attribute('nomoney_users');
|
my $broke_users = $entry->attribute('nomoney_users');
|
||||||
|
|
||||||
for my $account (sort keys %$broke_users) {
|
for my $account (sort keys %$broke_users) {
|
||||||
my $balance = RevBank::Users::balance($account);
|
my $balance = RevBank::Users::balance($account);
|
||||||
|
|
||||||
printf(
|
my $m = sprintf(
|
||||||
"\e[31;1m%s have %s.\e[m (balance: %s)\n",
|
"%s have %s",
|
||||||
($account eq $username ? "You don't" : "$account doesn't"),
|
($account eq $username ? "You don't" : "$account doesn't"),
|
||||||
abs($broke_users->{$account}),
|
abs($broke_users->{$account}),
|
||||||
|
);
|
||||||
|
my $b = sprintf(
|
||||||
|
"(balance: %s)",
|
||||||
($balance < 0 ? "\e[31;1m$balance\e[m" : $balance),
|
($balance < 0 ? "\e[31;1m$balance\e[m" : $balance),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
say "\e[31;1m$m\e[m $b";
|
||||||
|
call_hooks("log_info", "nomoney: $m $b");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
revbank
2
revbank
|
@ -17,7 +17,7 @@ use RevBank::Messages;
|
||||||
use RevBank::Cart;
|
use RevBank::Cart;
|
||||||
use RevBank::Prompt;
|
use RevBank::Prompt;
|
||||||
|
|
||||||
our $VERSION = "7.1.0";
|
our $VERSION = "7.2.0";
|
||||||
|
|
||||||
our %HELP1 = (
|
our %HELP1 = (
|
||||||
"abort" => "Abort the current transaction",
|
"abort" => "Abort the current transaction",
|
||||||
|
|
Loading…
Add table
Reference in a new issue