File: setupstdmsg.cc

package info (click to toggle)
natlog 3.01.00-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,912 kB
  • sloc: cpp: 3,691; fortran: 201; sh: 133; ansic: 123; makefile: 110
file content (41 lines) | stat: -rw-r--r-- 1,131 bytes parent folder | download | duplicates (3)
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
#include "natfork.ih"

void NatFork::setupStdMsg()
{
    if (d_options.stdout())             // if --stdout, then messages also go
        d_multiStreambuf.insert(cout);  // to stdout

    if (d_options.log().empty())        // no messages
        return;

    if (d_options.log() == "syslog")    // using syslog, and return
    {
        d_syslog.reset(
            new SyslogStream(
                d_options.syslogTag().c_str(), d_options.syslogPriority(), 
                d_options.syslogFacility()
            )
        );

        d_multiStreambuf.insert(*d_syslog);

        checkSyslogParam("facility", d_options.facility(), 
                                     d_options.syslogFacilityError());

        checkSyslogParam("priority", d_options.priority(), 
                                     d_options.syslogPriorityError());
        return;
    }

                                        // a log-file path was specified: 
                                        // create the rotating stream 

    d_log.open(d_options.log(), true);  // forwards --log to RotatingStreambuf

    d_multiStreambuf.insert(d_log);
}