<commit_before>use v6;

unit class Crust::Middleware::AccessLog does Callable;

use Apache::LogFormat;

has $.app;
has $.formatter;
has &.logger;

method new(Callable $app, *%opts) {
    my Apache::LogFormat::Formatter $formatter;
    given %opts<format> {
    when any(!.defined, Nil, "", "combined")
        { $formatter = Apache::LogFormat.combined }
    when "common"   { $formatter = Apache::LogFormat.common }
    when Apache::LogFormat::Compiler {
        $formatter = %opts<format>;
    }
    default {
        my $c = Apache::LogFormat::Compiler.new();
        $formatter = $c.compile(%opts<format>);
    }
    }
    %opts<format>:delete;

    %opts<formatter> = $formatter;
    self.bless(app => $app, |%opts);
}

my sub content-length(@res) {<commit_msg>Use !.Bool to catch all the False-y values<commit_after>use v6;

unit class Crust::Middleware::AccessLog does Callable;

use Apache::LogFormat;

has $.app;
has $.formatter;
has &.logger;

method new(Callable $app, *%opts) {
    my Apache::LogFormat::Formatter $formatter;
    given %opts<format> {
    when any(!.Bool, "combined")
        { $formatter = Apache::LogFormat.combined }
    when "common"   { $formatter = Apache::LogFormat.common }
    when Apache::LogFormat::Compiler {
        $formatter = %opts<format>;
    }
    default {
        my $c = Apache::LogFormat::Compiler.new();
        $formatter = $c.compile(%opts<format>);
    }
    }
    %opts<format>:delete;

    %opts<formatter> = $formatter;
    self.bless(app => $app, |%opts);
}

my sub content-length(@res) {
{'fraction_non_alphanumeric': 0.16354234001292825, 'fraction_numerical': 0.001292824822236587, 'mean_word_length': 3.422857142857143, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '4534517', 'n_tokens_mistral': 522, 'n_tokens_neox': 504, 'n_words': 112}