File: log.cc

package info (click to toggle)
filtermail 1.06.00-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,688 kB
  • sloc: cpp: 2,487; fortran: 249; makefile: 106; ansic: 51; sh: 36
file content (38 lines) | stat: -rw-r--r-- 681 bytes parent folder | download
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
//#define XERR
#include "current.ih"
#include <ostream>


namespace
{
    char const *s_action[] =
    {
        "ACCEPT",
        "IGNORE",
        "SPAM",
    };
}

void Current::log(eAction type)
{
    Log &log = Log::instance();

    if (d_rulesLine == string::npos)
        return;

    log << "Rules line " << d_rulesLine << " (" << s_action[type] << "): ";

    for (Data const &data: d_data)
    {
        log << data.filename << " header `" << data.header << "' ";

        if (data.idx == string::npos)
            log << "no match; ";
        else
            log << "matched by rule " << data.idx << "; ";
    }
    
    log << endl;

    d_rulesLine = string::npos;
}