Changeset 10976


Ignore:
Timestamp:
Jun 10, 2011, 10:54:16 AM (9 years ago)
Author:
tbretz
Message:
Added a log-file for everything entered.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r10922 r10976  
    114114    if (read_history(fName.c_str()))
    115115        cout << "WARNING - Reading " << fName << ": " << strerror(errno) << endl;
     116
     117    fCommandLog.open(string(prgname)+".evt");
    116118
    117119    // Setup the readline callback which are needed to redirect
     
    943945bool Readline::Process(const string &str)
    944946{
     947    fCommandLog << str << endl;
     948
    945949    if (str.substr(0, 3)==".w ")
    946950    {
     
    11111115    int rc = 0;
    11121116
    1113     ifstream fin(Tools::Trim(fname).c_str());
     1117    const string name = Tools::Trim(fname);
     1118
     1119    ifstream fin(name.c_str());
    11141120    if (!fin)
    11151121        return -1;
     1122
     1123    fCommandLog << "# START executing: " << name << endl;
    11161124
    11171125    string buffer;
     
    11261134
    11271135        rc++;
    1128 
     1136        // FIXME: Write command log
    11291137        if (Process(buffer))
    11301138            continue;
     
    11341142        AddToHistory(buffer);
    11351143    }
     1144
     1145    fCommandLog << "# FINISHED executing: " << name << endl;
    11361146
    11371147    return rc;
  • trunk/FACT++/src/Readline.h

    r10654 r10976  
    44#include <string>
    55#include <vector>
     6#include <fstream>
    67
    78class Readline
     
    1920    std::string fName;     /// Filename for the history file compiled in the constructor
    2021    int fMaxLines;         /// Maximum number of lines in the history file
     22
     23    std::ofstream fCommandLog;
    2124
    2225    std::string fLastLine; /// Last line adde to history
Note: See TracChangeset for help on using the changeset viewer.