<commit_before>use strict;
use warnings;

use Test::More 0.88;

use File::Spec;
use File::Temp qw( tempdir );

use Log::Dispatch;

my %tests;

BEGIN {
    foreach (qw( MailSend MIMELite MailSendmail MailSender )) {
        eval "use Log::Dispatch::Email::$_";
        $tests{$_} = !$@;
        $tests{$_} = 0 if $ENV{LD_NO_MAIL};
    }
}

my %TestConfig;
if ( my $email_address = $ENV{LOG_DISPATCH_TEST_EMAIL} ) {
    %TestConfig = ( email_address => $email_address );
}

my @syswrite_strs;

BEGIN {
    my $syswrite = \&CORE::syswrite;
    *CORE::GLOBAL::syswrite = sub {
        my ( $fh, $str, @other ) = @_;
        push @syswrite_strs, $_[1];

        # wth, CORE::syswrite(...) does not work here
        return $syswrite->( $fh, $str, @other );
    };
}

use Log::Dispatch::File;
use Log::Dispatch::Handle;
use Log::Dispatch::Null;
use Log::Dispatch::Screen;

use IO::File;

my $tempdir = tempdir( CLEANUP => 1 );

my $dispatch = Log::Dispatch->new;
ok( $dispatch, "created Log::Dispatch object" );

# Test Log::Dispatch::File
{
    my $emerg_log = File::Spec->catdir( $tempdir, 'emerg.log' );

    $dispatch->add(
        Log::Dispatch::File->new(
            name      => 'file1',<commit_msg>Remove comment<commit_after>use strict;
use warnings;

use Test::More 0.88;

use File::Spec;
use File::Temp qw( tempdir );

use Log::Dispatch;

my %tests;

BEGIN {
    foreach (qw( MailSend MIMELite MailSendmail MailSender )) {
        eval "use Log::Dispatch::Email::$_";
        $tests{$_} = !$@;
        $tests{$_} = 0 if $ENV{LD_NO_MAIL};
    }
}

my %TestConfig;
if ( my $email_address = $ENV{LOG_DISPATCH_TEST_EMAIL} ) {
    %TestConfig = ( email_address => $email_address );
}

my @syswrite_strs;

BEGIN {
    my $syswrite = \&CORE::syswrite;
    *CORE::GLOBAL::syswrite = sub {
        my ( $fh, $str, @other ) = @_;
        push @syswrite_strs, $_[1];

        return $syswrite->( $fh, $str, @other );
    };
}

use Log::Dispatch::File;
use Log::Dispatch::Handle;
use Log::Dispatch::Null;
use Log::Dispatch::Screen;

use IO::File;

my $tempdir = tempdir( CLEANUP => 1 );

my $dispatch = Log::Dispatch->new;
ok( $dispatch, "created Log::Dispatch object" );

# Test Log::Dispatch::File
{
    my $emerg_log = File::Spec->catdir( $tempdir, 'emerg.log' );

    $dispatch->add(
        Log::Dispatch::File->new(
            name      => 'file1',
{'fraction_non_alphanumeric': 0.17922520221370797, 'fraction_numerical': 0.005959982971477224, 'mean_word_length': 3.3357933579335795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '449797', 'n_tokens_mistral': 871, 'n_tokens_neox': 852, 'n_words': 196}