Changeset 11580 for trunk


Ignore:
Timestamp:
07/24/11 22:34:29 (13 years ago)
Author:
tbretz
Message:
Added --null option to suppress the output more or less completely.
Location:
trunk/FACT++/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Console.h

    r11053 r11580  
    1212public:
    1313    ConsoleStream(const char *name);
     14
     15    void SetNullOutput(bool null) { fLogO.SetNullOutput(null); }
    1416
    1517    // I/O
  • trunk/FACT++/src/LocalControl.h

    r11479 r11580  
    154154{
    155155public:
    156     LocalStream(const char *name, bool = false)
    157         : LocalControl<ConsoleStream>(name) { }
     156    LocalStream(const char *name, bool null = false)
     157        : LocalControl<ConsoleStream>(name) { SetNullOutput(null); }
    158158};
    159159
  • trunk/FACT++/src/Main.h

    r11577 r11580  
    2020            ("host",      var<string>(""),                "Address with which the Dim nameserver can connect to this host (overwites DIM_HOST_NODE environment variable)")
    2121            ("log,l",     var<string>(n), "Write log-file")
     22            ("null",      po_switch(),    "Suppresses almost all console output - including errors (only available without --console option)")
    2223            ("console,c", var<int>(),     "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
    2324            ("cmd",       vars<string>(), "Execute one or more commands at startup")
     
    4748        // -----------------------------------------------------------------
    4849
     50        cout << conf.Has("console") << endl;
     51        cout << conf.Has("null") << endl;
    4952        static T shell(conf.GetName().c_str(),
    50                    conf.Has("console") ? conf.Get<int>("console")!=1 : 0);
     53                   conf.Has("console") ? conf.Get<int>("console")!=1 : conf.Get<bool>("null"));
    5154
    5255        WindowLog &win  = shell.GetStreamIn();
    5356        WindowLog &wout = shell.GetStreamOut();
    5457
     58        // Switching off buffering is not strictly necessary, since
     59        // the destructor of shell should flush everything still buffered,
     60        // nevertheless it helps to debug problems in the initialization
     61        // sequence.
    5562        const bool backlog = wout.GetBacklog();
    5663        const bool null    = wout.GetNullOutput();
    57         wout.SetBacklog(false);
    58         wout.SetNullOutput(false);
    59         wout.Display(true);
     64        if (conf.Has("console") || !conf.Get<bool>("null"))
     65        {
     66            wout.SetBacklog(false);
     67            wout.SetNullOutput(false);
     68            wout.Display(true);
     69        }
    6070
    6171        if (conf.Has("log"))
     
    116126        io_service.Message("==================== Starting main loop =================");
    117127
    118         wout.SetNullOutput(null);
    119         wout.SetBacklog(backlog);
     128        if (conf.Has("console") || !conf.Get<bool>("null"))
     129        {
     130            wout.SetNullOutput(null);
     131            wout.SetBacklog(backlog);
     132        }
    120133
    121134        shell.SetReceiver(io_service);
Note: See TracChangeset for help on using the changeset viewer.