Changeset 17341


Ignore:
Timestamp:
Nov 21, 2013, 5:43:34 PM (6 years ago)
Author:
tbretz
Message:
Implemented an output if between two messages, the date changes. This makes it easier to follow a long log file.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/MessageImp.cc

    r15080 r17341  
    106106//!    The severity of the message
    107107//
    108 int MessageImp::Write(const Time &time, const string &txt, int severity)
     108int MessageImp::WriteImp(const Time &time, const string &txt, int severity)
    109109{
    110110    if (severity==kAlarm && txt.length()==0)
     
    128128    fOut << time.GetAsStr("%H:%M:%S.%f") << " - " << txt << endl;
    129129
     130    return 0;
     131}
     132
     133int MessageImp::Write(const Time &time, const string &txt, int severity)
     134{
     135    const uint32_t mjd = time.Mjd();
     136
     137    if (fLastMjd != mjd)
     138        WriteImp(time, "=================== "+time.GetAsStr("%Y-%m-%d")+" ["+to_string(mjd)+"] ==================");
     139
     140    fLastMjd = mjd;
     141
     142    WriteImp(time, txt, severity);
    130143    return 0;
    131144}
  • trunk/FACT++/src/MessageImp.h

    r16737 r17341  
    2626private:
    2727    std::ostream &fOut; /// The ostream to which by default Write redirects its output
     28    uint32_t fLastMjd;  /// Mjd of last message
     29
     30    int WriteImp(const Time &time, const std::string &txt, int qos=kMessage);
    2831
    2932public:
Note: See TracChangeset for help on using the changeset viewer.