74 const boost::regex reg(
"\x1B\[([0-9]{1,3}(;[0-9]{1,3})?[a-zA-Z]");
76 const uint32_t night = atoi(fname.c_str());
77 if (night>20000000 && night<21000000 &&to_string(night)==fname)
78 fname =
Tools::Form(
"/fact/aux/%04d/%02d/%02d/%d.log",
79 night/10000, (night/100)%100, night%100, night);
82 cerr <<
"Reading " << fname << endl;
84 ifstream fin(fname.empty() ?
"/dev/stdin" : fname.c_str());
86 throw runtime_error(strerror(errno));
94 while (getline(fin, buffer,
'\n'))
97 buffer = boost::regex_replace(buffer, reg,
"");
102 if (buffer.size()>18)
104 const string tm = buffer.substr(4, 15);
106 const Time t(
"1970-01-01 "+tm);
133 if (buffer.size()>1 && !strip)
138 case ' ': lvl = 7;
break;
139 case '#': lvl = 6;
break;
140 case '-': lvl = 5;
break;
141 case '>': lvl = 4;
break;
142 case 'I': lvl = 3;
break;
143 case 'W': lvl = 2;
break;
144 case 'E': lvl = 1;
break;
145 case '!': lvl = 0;
break;
153 case ' ': log <<
kBlue;
break;
156 case '>': log <<
kBold;
break;
157 case 'I': log <<
kGreen;
break;
158 case 'W': log <<
kYellow;
break;
159 case 'E': log <<
kRed;
break;
160 case '!': log << kRed <<
kBlink;
break;
164 (strip?cout:log) << buffer << endl;
Adds some functionality to boost::posix_time::ptime for our needs.
A C++ ostream to an ncurses window supporting attributes and colors.