31 #include <boost/shared_ptr.hpp>
44 namespace pexExcept = lsst::pex::exceptions;
54 : _send(threshold <= importance), _showAll(showAll), _vol(importance),
72 LogRecord::LogRecord(
int threshold,
int importance,
const PropertySet& preamble,
74 : _send(threshold <= importance), _showAll(showAll), _vol(importance),
81 _data = boost::shared_ptr<PropertySet>(
new PropertySet());
89 LogRecord::~LogRecord() { }
91 long long LogRecord::utcnow() {
94 gettimeofday(&tv,&tz);
98 long long nsec =
static_cast<long long>(tv.tv_sec) * 1000000000L;
99 nsec += tv.tv_usec * 1000L;
103 void LogRecord::setTimestamp() {
109 void LogRecord::setDate() {
117 time_t secs = (time_t) tv.tv_sec;
118 gmtime_r(&secs, &timeinfo);
120 if ( 0 == strftime(datestr,39,
"%Y-%m-%dT%H:%M:%S.", &timeinfo) ) {
122 "Failed to format time successfully");
125 string fulldate(str(
format(
"%s%d") %
string(datestr) % tv.tv_usec));
129 size_t LogRecord::countParamValues()
const {
131 std::vector<std::string> names = _data->names(
false);
132 std::vector<std::string>::iterator it;
133 for(it = names.begin(); it != names.end(); ++it) {
134 sum += _data->valueCount(*it);
139 void LogRecord::addProperties(
const PropertySet& props) {
141 if (temp->exists(
"LEVEL")) temp->remove(
"LEVEL");
142 if (temp->exists(
"LOG")) temp->remove(
"LOG");
143 if (temp->exists(
"TIMESTAMP")) temp->remove(
"TIMESTAMP");
144 if (temp->exists(
"DATE")) temp->remove(
"DATE");
145 data().combine(temp);
Class for handling dates/times, including MJD, UTC, and TAI.
boost::shared_ptr< PropertySet > Ptr
#define LSST_LP_TIMESTAMP
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
lsst::daf::base::PropertySet PropertySet
definition of the LogRecord, RecordProperty and Prop classes
Interface for DateTime class.
#define LSST_EXCEPT(type,...)
Class for storing generic metadata.
virtual Ptr deepCopy(void) const
Include files required for standard LSST Exception handling.