LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
LSSTDataManagementBasePackage
LogEvent.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008-2015 AURA/LSST.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <https://www.lsstcorp.org/LegalNotices/>.
23  */
24 
33 #include <iomanip>
34 
37 
39 
40 namespace lsst {
41 namespace ctrl {
42 namespace events {
43 
44 const std::string LogEvent::LEVEL = "LEVEL";
45 const std::string LogEvent::LOGGER = "LOGGER";
46 
47 const std::string LogEvent::MESSAGE = "message";
48 const std::string LogEvent::TIMESTAMP = "timestamp";
49 const std::string LogEvent::THREADNAME = "threadname";
50 const std::string LogEvent::FILENAME = "filename";
51 const std::string LogEvent::CLASSNAME = "classname";
52 const std::string LogEvent::METHODNAME = "methodname";
53 const std::string LogEvent::LINENUMBER = "linenumber";
54 const std::string LogEvent::LOCATION = "location";
55 
56 const std::string LogEvent::LOGGING_TOPIC = "Logging";
57 
63  _init();
64 }
65 
66 LogEvent::LogEvent(LocationId const& originatorId, PropertySet const& ps) : StatusEvent(originatorId, ps) {
67  _init();
68 
69  //# TODO: don't set this in EventAppender
70 
72 }
73 
74 
78  _keywords.insert(LogEvent::LEVEL);
80 }
81 
82 
87 LogEvent::LogEvent(cms::TextMessage *msg) : StatusEvent(msg) {
88  _init();
89 
90  _psp->set(LogEvent::LEVEL, msg->getIntProperty(LogEvent::LEVEL));
91  _psp->set(LogEvent::LOGGER, msg->getStringProperty(LogEvent::LOGGER));
92 
93 
94 }
95 
99 void LogEvent::populateHeader(cms::TextMessage* msg) const {
101 
102  msg->setIntProperty(LogEvent::LEVEL, _psp->get<int>(LogEvent::LEVEL));
103  msg->setStringProperty(LogEvent::LOGGER, _psp->get<std::string>(LogEvent::LOGGER));
104 
105 }
106 
112  return _psp->get<int>(LogEvent::LEVEL);
113 }
114 
119 std::string LogEvent::getLogger() {
120  return _psp->get<std::string>(LogEvent::LOGGER);
121 }
122 
129 }
130 
135 }
136 
137 }}}
static const std::string LEVEL
Definition: LogEvent.h:66
static const std::string TIMESTAMP
Definition: LogEvent.h:71
static const std::string LOGGING_TOPIC
Definition: LogEvent.h:79
std::set< std::string > _keywords
Definition: Event.h:243
LogEvent()
Creates LogEvent which contains a PropertySet.
Definition: LogEvent.cc:62
defines EventTypes
std::string getLogger()
Retreive the log message.
Definition: LogEvent.cc:119
static const std::string METHODNAME
Definition: LogEvent.h:75
Representation of an LSST Event.
Definition: StatusEvent.h:61
virtual ~LogEvent()
destructor
Definition: LogEvent.cc:134
static const std::string THREADNAME
Definition: LogEvent.h:72
static const std::string LOG
Definition: EventTypes.h:47
static const std::string MESSAGE
Definition: LogEvent.h:70
int getLevel()
retreive the log level
Definition: LogEvent.cc:111
static const std::string CLASSNAME
Definition: LogEvent.h:74
defines the LogEvent class
virtual void populateHeader(cms::TextMessage *msg) const
Definition: LogEvent.cc:99
static const std::string TYPE
Definition: Event.h:64
static const std::string LOGGER
Definition: LogEvent.h:67
Class for storing generic metadata.
Definition: PropertySet.h:82
std::string getLoggingTopic()
Retreive the log message.
Definition: LogEvent.cc:127
static const std::string FILENAME
Definition: LogEvent.h:73
Represent process that created an event.
Definition: LocationId.h:52
Interface for PropertySet class.
virtual void populateHeader(cms::TextMessage *msg) const
populate a cms::TextMessage header with properties
Definition: StatusEvent.cc:111
boost::shared_ptr< PropertySet > _psp
Definition: Event.h:241
static const std::string LOCATION
Definition: LogEvent.h:77
static const std::string LINENUMBER
Definition: LogEvent.h:76