1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
mod addr;
mod paths;
mod referers;
pub mod summary;
mod status;
mod methods;
mod printer;
mod section;
mod skin;

pub use {
    printer::*,
    section::*,
};

use {
    crate::*,
};

pub fn print_analysis(
    base: &LogBase,
    printer: &Printer,
    trend_computer: Option<&TrendComputer>,
) {
    if base.is_empty() {
        return;
    }
    // note about times: the first markdown template expansion (whatever it is)
    // costs a lot when there's a filtering. I don't know exactly why.
    let lines = &base.lines;
    for field in &printer.fields.0 {
        match field {
            Field::Dates => {
                let histogram = Histogram::from(&base);
                time!(
                    "histogram printing",
                    histogram.print(printer),
                );
            }
            Field::Methods => {
                time!(
                    "print_methods",
                    methods::print_methods(lines, printer, trend_computer),
                );
            }
            Field::Status => {
                time!(
                    "print_status_codes",
                    status::print_status_codes(lines, printer, trend_computer),
                );
            }
            Field::Ip => {
                time!(
                    "print_remote_addresses",
                    addr::print_remote_addresses(lines, printer, trend_computer),
                );
            }
            Field::Referers => {
                time!(
                    "print_referers",
                    referers::print_referers(lines, printer, trend_computer),
                );
            }
            Field::Paths => {
                time!(
                    "print_paths",
                    paths::print_paths(lines, printer, trend_computer),
                );
            }
        }
    }
}