37 #include <boost/shared_ptr.hpp>
38 #include <boost/any.hpp>
48 namespace dafBase = lsst::daf::base;
49 namespace pexExcept = lsst::pex::exceptions;
78 std::vector<std::string> comments;
79 std::vector<std::string>::iterator vi;
84 else if (level >=
Log::WARN) levstr =
" WARNING: ";
85 else if (level <
Log::INFO) levstr =
" DEBUG: ";
86 }
catch (pexExcept::TypeError ex) {
87 }
catch (pexExcept::NotFoundError ex) { }
91 }
catch (pexExcept::TypeError ex) {
92 log =
"mis-specified_log_name";
93 }
catch (pexExcept::NotFoundError ex) { }
97 }
catch (pexExcept::TypeError ex) {
98 comments.push_back(
"(mis-specified_comment)");
99 }
catch (pexExcept::NotFoundError ex) { }
101 for(vi = comments.begin(); vi != comments.end(); ++vi) {
102 (*strm) << log << levstr << *vi << std::endl;
106 std::vector<std::string> names = rec.data().paramNames(
false);
107 for(vi = names.begin(); vi != names.end(); ++vi) {
111 PropertyPrinter pp(rec.data(), *vi);
113 (*strm) <<
" " << *vi <<
": ";
114 pi.write(strm) << std::endl;
117 (*strm) << std::endl;
139 std::vector<std::string> comments;
140 std::vector<std::string>::iterator vi;
145 else if (level >=
Log::WARN) levstr =
" WARNING: ";
146 else if (level <
Log::INFO) levstr =
" DEBUG: ";
147 }
catch (pexExcept::TypeError ex) {
148 }
catch (pexExcept::NotFoundError ex) { }
152 }
catch (pexExcept::TypeError ex) {
153 log =
"mis-specified_log_name";
154 }
catch (pexExcept::NotFoundError ex) { }
158 }
catch (pexExcept::TypeError ex) {
159 comments.push_back(
"(mis-specified_comment)");
160 }
catch (pexExcept::NotFoundError ex) { }
162 std::ostringstream indentstr;
165 for(
int i=level; i < 0; ++i) {
169 string indent(indentstr.str());
171 for(vi = comments.begin(); vi != comments.end(); ++vi) {
172 (*strm) << indent << log << levstr << *vi << std::endl;
176 std::vector<std::string> names = rec.data().paramNames(
false);
177 for(vi = names.begin(); vi != names.end(); ++vi) {
181 PropertyPrinter pp(rec.data(), *vi);
183 (*strm) << indent <<
" " << *vi <<
": ";
184 pi.write(strm) << std::endl;
187 (*strm) << std::endl;
199 : LogFormatter(), _tplookup(), _midfix(valueDelim)
204 NetLoggerFormatter::~NetLoggerFormatter() { }
206 #define LSST_TL_ADD(T, C) _tplookup[typeid(T).name()] = C
208 void NetLoggerFormatter::loadTypeLookup() {
209 LSST_TL_ADD(
int,
'i');
210 LSST_TL_ADD(
long,
'l');
211 LSST_TL_ADD(
long long,
'L');
212 LSST_TL_ADD(
char,
'c');
213 LSST_TL_ADD(std::string,
's');
215 LSST_TL_ADD(
float,
'f');
216 LSST_TL_ADD(
double,
'd');
217 LSST_TL_ADD(
bool,
'b');
223 NetLoggerFormatter& NetLoggerFormatter::operator=(
const NetLoggerFormatter& that)
225 if (
this == &that)
return *
this;
227 dynamic_cast<NetLoggerFormatter*
>(
this)->
operator=(that);
228 _midfix = that._midfix;
237 void NetLoggerFormatter::write(std::ostream *strm,
const LogRecord& rec) {
240 std::vector<std::string> comments;
241 std::vector<std::string>::iterator vi;
243 std::vector<std::string> names = rec.data().paramNames(
false);
244 for(vi = names.begin(); vi != names.end(); ++vi) {
245 char tp = _tplookup[rec.data().typeOf(*vi).name()];
252 PropertyPrinter pp(rec.data(), *vi);
253 for(PropertyPrinter::iterator pi=pp.begin(); pi.notAtEnd(); ++pi) {
254 (*strm) << tp <<
" " << *vi << _midfix;
255 pi.write(strm) << newl;
256 if (!wrote) wrote =
true;
260 if (wrote) (*strm) << std::endl;
Class for handling dates/times, including MJD, UTC, and TAI.
PrinterList::iterator iterator
definition of the LogRecord, RecordProperty and Prop classes
definition of the PropertyPrinter class and its helpers
virtual bool notAtEnd() const
Interface for PropertySet class.
Include files required for standard LSST Exception handling.