3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-09 21:49:34 +01:00
pbot/lib/PBot/Utils/SQLiteLoggerLayer.pm
Pragmatic Software ea63ef8fe8 Massive reorganization
Storage-related packages have been moved to PBot/Storage/.

MessageHistory_SQLite.pm has been moved to MessageHistory/Storage/SQLite.pm.

Quotegrabs' storage packages have been moved to Plugin/Quotegrabs/Storage/.

IRC handler-related packages have been moved to PBot/IRCHandlers/.

Commands registered by core PBot packages have been moved to PBot/Commands/.

Some non-core packages have been moved to PBot/Utils/.

Several packages have been cleaned up.

TODO: Move remaining core commands and IRC handlers.

TODO: Split AntiFlood.pm into Plugin/AntiAbuse/ files.
2021-07-20 21:38:07 -07:00

37 lines
655 B
Perl

# File: SQLiteLoggerLayer
#
# Purpose: PerlIO::via layer to log DBI trace messages.
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT
package PBot::Utils::SQLiteLoggerLayer;
use PBot::Imports;
sub PUSHED {
my ($class, $mode, $fh) = @_;
my $logger;
return bless \$logger, $class;
}
sub OPEN {
my ($self, $path, $mode, $fh) = @_;
$$self = $path; # path is our PBot::Logger object
return 1;
}
sub WRITE {
my ($self, $buf, $fh) = @_;
$$self->log($buf); # log message
return length($buf);
}
sub CLOSE {
my ($self) = @_;
$$self->close();
return 0;
}
1;