mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-09 13:39:34 +01:00
38 lines
745 B
Perl
38 lines
745 B
Perl
# File: SQLiteLoggerLayer
|
|
#
|
|
# Purpose: PerlIO::via layer to log DBI trace messages.
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package PBot::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;
|