2014-05-20 12:17:01 +02:00
|
|
|
# File: SQLiteLoggerLayer
|
|
|
|
#
|
2021-06-19 06:23:34 +02:00
|
|
|
# Purpose: PerlIO::via layer to log DBI trace messages.
|
2014-05-20 12:17:01 +02:00
|
|
|
|
2023-02-21 06:31:52 +01:00
|
|
|
# SPDX-FileCopyrightText: 2014-2023 Pragmatic Software <pragma78@gmail.com>
|
2021-07-11 00:00:22 +02:00
|
|
|
# SPDX-License-Identifier: MIT
|
2017-03-05 22:33:31 +01:00
|
|
|
|
2021-07-24 04:22:25 +02:00
|
|
|
package PBot::Core::Utils::SQLiteLoggerLayer;
|
2014-05-20 12:17:01 +02:00
|
|
|
|
2021-06-19 06:23:34 +02:00
|
|
|
use PBot::Imports;
|
2019-07-11 03:40:53 +02:00
|
|
|
|
2023-04-17 19:33:02 +02:00
|
|
|
sub PUSHED($class, $mode, $fh = undef) {
|
2020-02-15 23:38:32 +01:00
|
|
|
my $logger;
|
|
|
|
return bless \$logger, $class;
|
2014-05-20 12:17:01 +02:00
|
|
|
}
|
|
|
|
|
2023-04-17 19:33:02 +02:00
|
|
|
sub OPEN($self, $path, $mode = undef, $fh = undef) {
|
2021-06-19 06:23:34 +02:00
|
|
|
$$self = $path; # path is our PBot::Logger object
|
2020-02-15 23:38:32 +01:00
|
|
|
return 1;
|
2014-05-20 12:17:01 +02:00
|
|
|
}
|
|
|
|
|
2023-04-17 19:33:02 +02:00
|
|
|
sub WRITE($self, $buf, $fh = undef) {
|
2021-06-19 06:23:34 +02:00
|
|
|
$$self->log($buf); # log message
|
2020-02-15 23:38:32 +01:00
|
|
|
return length($buf);
|
2014-05-20 12:17:01 +02:00
|
|
|
}
|
|
|
|
|
2023-04-14 06:04:12 +02:00
|
|
|
sub CLOSE($self) {
|
2020-02-15 23:38:32 +01:00
|
|
|
$$self->close();
|
|
|
|
return 0;
|
2014-05-20 12:17:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|