<commit_before>package PEF::Log::OverAppender;
use base 'PEF::Log::Appender';
use Carp;
use strict;
use warnings;

sub new {
	my ($class, %params) = @_;
	my $self = $class->SUPER::new(%params)->reload(\%params);
	$self;
}

sub reload {
	my ($self, $params) = @_;
	$self->_reload($params);
	if (not exists ($params->{appender})) {
		croak "need appender for overs";
	}
	if (not exists $PEF::Log::Config::config{appenders}{$params->{appender}}) {
		croak "unknown appender $params->{appender}";
	}
	$self->{appender} = $PEF::Log::Config::config{appenders}{$params->{appender}};
	my $app_sub = <<APS;
	sub {
		my (\$self, \$level, \$stream, \$msg) = \@_;
APS
	if (exists $self->{filter}) {
		$app_sub .= <<APS;
		local \$self->{appender}->{filter} = \$self->{filter};
APS
	}
	if (exists $self->{formatter}) {
		$app_sub .= <<APS;
		local \$self->{appender}->{formatter} = \$self->{formatter};
APS
	}
	$app_sub .= <<APS;
		local \$PEF::Log::caller_offset = \$PEF::Log::caller_offset + 1;
		\$self->{appender}->append(\$level, \$stream, \$msg);
	}
APS
	eval "\$self->{sub} = $app_sub";
	$self;
}

sub append {
	my ($self, $level, $stream, $msg) = @_;
	$self->{sub}->($self, $level, $stream, $msg);
}

1;<commit_msg>fix caller offset problem - 2 <commit_after>package PEF::Log::OverAppender;
use base 'PEF::Log::Appender';
use Carp;
use strict;
use warnings;

sub new {
	my ($class, %params) = @_;
	my $self = $class->SUPER::new(%params)->reload(\%params);
	$self;
}

sub reload {
	my ($self, $params) = @_;
	$self->_reload($params);
	if (not exists ($params->{appender})) {
		croak "need appender for overs";
	}
	if (not exists $PEF::Log::Config::config{appenders}{$params->{appender}}) {
		croak "unknown appender $params->{appender}";
	}
	$self->{appender} = $PEF::Log::Config::config{appenders}{$params->{appender}};
	my $app_sub = <<APS;
	sub {
		my (\$self, \$level, \$stream, \$msg) = \@_;
APS
	if (exists $self->{filter}) {
		$app_sub .= <<APS;
		local \$self->{appender}->{filter} = \$self->{filter};
APS
	}
	if (exists $self->{formatter}) {
		$app_sub .= <<APS;
		local \$self->{appender}->{formatter} = \$self->{formatter};
APS
	}
	$app_sub .= <<APS;
		my \$of = \$PEF::Log::caller_offset;
		local \$PEF::Log::caller_offset = \$of + 1;
		\$self->{appender}->append(\$level, \$stream, \$msg);
	}
APS
	eval "\$self->{sub} = $app_sub";
	$self;
}

sub append {
	my ($self, $level, $stream, $msg) = @_;
	$self->{sub}->($self, $level, $stream, $msg);
}

1;
{'fraction_non_alphanumeric': 0.2505091649694501, 'fraction_numerical': 0.002036659877800407, 'mean_word_length': 4.433628318584071, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4303481', 'n_tokens_mistral': 1063, 'n_tokens_neox': 989, 'n_words': 205}