3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-02-16 21:40:46 +01:00

Make some log messages more consistent

This commit is contained in:
Pragmatic Software 2023-01-30 15:50:26 -08:00
parent 02d690600b
commit 441e858a84
4 changed files with 18 additions and 11 deletions

View File

@ -140,15 +140,22 @@ sub check_flood {
$self->{pbot}->{messagehistory}->{database}->update_hostmask_data($mask, {last_seen => scalar gettimeofday});
if ($mode == MSG_NICKCHANGE) {
$self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", "NICKCHANGE", $mask, $text));
my ($newnick) = $text =~ m/NICKCHANGE (.*)/;
$self->{pbot}->{logger}->log("[NICKCHANGE] ($account) $mask changed nick to $newnick\n");
$mask = "$newnick!$user\@$host";
$account = $self->{pbot}->{messagehistory}->get_message_account($newnick, $user, $host);
$nick = $newnick;
$self->{pbot}->{messagehistory}->{database}->update_hostmask_data($mask, {last_seen => scalar gettimeofday});
} else {
$self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", $channel eq lc $mask ? "QUIT" : $channel, $mask, $text));
if ($mode == MSG_CHAT) {
$self->{pbot}->{logger}->log("[MSG] $channel ($account) $mask => $text\n");
} else {
my $from = $channel eq lc $mask ? "QUIT" : $channel;
my ($type) = $text =~ /^(\w+) /;
$self->{pbot}->{logger}->log("[$type] $from ($account) $mask => $text\n");
}
}
# do not do flood processing for bot messages

View File

@ -62,7 +62,7 @@ sub on_mode {
$mode = $modifier . $flag;
$target = $event->{event}->{args}->[++$i];
$self->{pbot}->{logger}->log("Mode $channel [$mode" . (length $target ? " $target" : '') . "] by $source\n");
$self->{pbot}->{logger}->log("[MODE] $channel $mode" . (length $target ? " $target" : '') . " by $source\n");
# dispatch a single mode flag event
$self->{pbot}->{event_dispatcher}->dispatch_event(

View File

@ -1744,7 +1744,7 @@ sub get_also_known_as {
my ($self, $nick, $dont_use_aliases_table) = @_;
my $debug = $self->{pbot}->{registry}->get_value('messagehistory', 'debug_aka');
$self->{pbot}->{logger}->log("Looking for AKAs for nick [$nick]\n") if $debug;
$self->{pbot}->{logger}->log("[AKA] Checking nick $nick\n") if $debug;
my %akas = eval {
my (%akas, %hostmasks, %ids);
@ -1755,7 +1755,7 @@ sub get_also_known_as {
if (not defined $id) { return %akas; }
$ids{$id} = {id => $id, type => $self->{alias_type}->{STRONG}};
$self->{pbot}->{logger}->log("Adding $id -> $id\n") if $debug;
$self->{pbot}->{logger}->log("Adding $id -> $id\n") if $debug > 2;
my $sth = $self->{dbh}->prepare('SELECT alias, type FROM Aliases WHERE id = ?');
$sth->execute($id);
@ -1764,7 +1764,7 @@ sub get_also_known_as {
foreach my $row (@$rows) {
# next if $row->{type} == $self->{alias_type}->{WEAK};
$ids{$row->{alias}} = {id => $id, type => $row->{type}};
$self->{pbot}->{logger}->log("[$id] 1) Adding $row->{alias} -> $id [type $row->{type}]\n") if $debug;
$self->{pbot}->{logger}->log("[$id] 1) Adding $row->{alias} -> $id [type $row->{type}]\n") if $debug > 2;
}
my %seen_id;
@ -1786,7 +1786,7 @@ sub get_also_known_as {
#next if $row->{type} == $self->{alias_type}->{WEAK};
$ids{$row->{id}} = {id => $id, type => $ids{$id}->{type} == $self->{alias_type}->{WEAK} ? $self->{alias_type}->{WEAK} : $row->{type}};
$new_aliases++;
$self->{pbot}->{logger}->log("[$id] 2) Adding $row->{id} -> $id [type $row->{type}]\n") if $debug;
$self->{pbot}->{logger}->log("[$id] 2) Adding $row->{id} -> $id [type $row->{type}]\n") if $debug > 2;
}
}
last if not $new_aliases;
@ -1816,7 +1816,7 @@ sub get_also_known_as {
last_seen => $row->{last_seen},
};
$self->{pbot}->{logger}->log("[$id] Adding hostmask $row->{hostmask} -> $ids{$id}->{id} [type $ids{$id}->{type}]\n") if $debug;
$self->{pbot}->{logger}->log("[AKA] hostmask ($id) $row->{hostmask} -> $ids{$id}->{id} [type $ids{$id}->{type}]\n") if $debug;
}
$nickserv_sth->execute($id);

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4608,
BUILD_DATE => "2023-01-28",
BUILD_REVISION => 4609,
BUILD_DATE => "2023-01-30",
};
sub initialize {}