96 _devnull =
new ofstream(
"/dev/null") ;
139 map<string,ostream*>::iterator iter =
_files.begin() ;
140 for (; iter !=
_files.end() ; ++iter) {
141 delete iter->second ;
210 pc.defineInt(
"prefix",
"Prefix",0,
kTRUE) ;
212 pc.defineInt(
"topic",
"Topic",0,0xFFFFF) ;
213 pc.defineString(
"objName",
"ObjectName",0,
"") ;
214 pc.defineString(
"className",
"ClassName",0,
"") ;
215 pc.defineString(
"baseClassName",
"BaseClassName",0,
"") ;
216 pc.defineString(
"tagName",
"LabelName",0,
"") ;
217 pc.defineString(
"outFile",
"OutputFile",0,
"") ;
218 pc.defineObject(
"outStream",
"OutputStream",0,0) ;
219 pc.defineMutex(
"OutputFile",
"OutputStream") ;
229 const char* objName =
pc.getString(
"objName") ;
230 const char* className =
pc.getString(
"className") ;
231 const char* baseClassName =
pc.getString(
"baseClassName") ;
232 const char* tagName =
pc.getString(
"tagName") ;
233 const char* outFile =
pc.getString(
"outFile") ;
234 Bool_t prefix =
pc.getInt(
"prefix") ;
236 ostream* os =
reinterpret_cast<ostream*
>(
pc.getObject(
"outStream")) ;
244 newStream.
topic = topic ;
245 newStream.
objectName = (objName ? objName :
"" ) ;
246 newStream.
className = (className ? className :
"" ) ;
247 newStream.
baseClassName = (baseClassName ? baseClassName :
"" ) ;
248 newStream.
tagName = (tagName ? tagName :
"" ) ;
249 newStream.
color = color ;
250 newStream.
prefix = prefix ;
264 }
else if (
string(outFile).size()>0) {
267 ostream* os2 =
_files[
"outFile"] ;
272 os2 =
new ofstream(outFile) ;
275 cout <<
"RooMsgService::addReportingStream ERROR: cannot open output log file " << outFile <<
" reverting stream to stdout" << endl ;
277 newStream.
os = &cout ;
291 newStream.
os = &cout ;
310 vector<StreamConfig>::iterator iter =
_streams.begin() ;
314 if (iter->minLevel==
DEBUG) {
329 cout <<
"RooMsgService::setStreamStatus() ERROR: invalid stream ID " <<
id << endl ;
349 cout <<
"RooMsgService::getStreamStatus() ERROR: invalid stream ID " <<
id << endl ;
417 if (
_streams[i].match(level,topic,self)) {
432 if (
_streams[i].match(level,topic,self)) {
465 if (!active)
return kFALSE ;
466 if (level<minLevel)
return kFALSE ;
467 if (!(topic&top))
return kFALSE ;
469 if (universal)
return kTRUE ;
471 if (objectName.size()>0 && objectName != obj->
GetName())
return kFALSE ;
472 if (className.size()>0 && className != obj->IsA()->
GetName())
return kFALSE ;
473 if (baseClassName.size()>0 && !obj->IsA()->
InheritsFrom(baseClassName.c_str()))
return kFALSE ;
554 if (
TString(options).Contains(
"V") ||
TString(options).Contains(
"v")) {
558 cout << (activeOnly?
"Active Message streams":
"All Message streams") << endl ;
562 if (activeOnly && !
_streams[i].active) {
568 cout <<
"[" << i <<
"] MinLevel = " << is->second ;
570 cout <<
" Topic = " ;
572 map<int,string>::const_iterator iter =
_topicNames.begin() ;
574 if (iter->first &
_streams[i].topic) {
575 cout << iter->second <<
" " ;
584 if (
_streams[i].objectName.size()>0) {
585 cout <<
" ObjectName = " <<
_streams[i].objectName ;
587 if (
_streams[i].className.size()>0) {
588 cout <<
" ClassName = " <<
_streams[i].className ;
590 if (
_streams[i].baseClassName.size()>0) {
591 cout <<
" BaseClassName = " <<
_streams[i].baseClassName ;
594 cout <<
" TagLabel = " <<
_streams[i].tagName ;
598 if (!activeOnly && !
_streams[i].active) {
599 cout <<
" (NOT ACTIVE)" ;
RooMsgService * gMsgService
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
The RooMsgService class is a singleton class that organizes informational, debugging,...
static void cleanup()
Cleanup function called by atexit() handler installed by RooSentinel to delete all global object upon...
std::vector< StreamConfig > _streams
void restoreState()
Restore last saved state of message service.
void setStreamStatus(Int_t id, Bool_t active)
(De)Activate stream with given unique ID
Bool_t getStreamStatus(Int_t id) const
Get activation status of stream with given unique ID.
static RooMsgService & instance()
Return reference to singleton instance.
RooFit::MsgLevel _globMinLevel
Bool_t isActive(const RooAbsArg *self, RooFit::MsgTopic facility, RooFit::MsgLevel level)
Check if logging is active for given object/topic/RooFit::MsgLevel combination.
static RooMsgService * _instance
std::stack< std::vector< StreamConfig > > _streamsSaved
RooMsgService()
Constructor.
RooWorkspace * debugWorkspace()
void saveState()
Save current state of message service.
std::map< int, std::string > _topicNames
std::ostream & log(const RooAbsArg *self, RooFit::MsgLevel level, RooFit::MsgTopic facility, Bool_t forceSkipPrefix=kFALSE)
Log error message associated with RooAbsArg object self at given level and topic.
Int_t addStream(RooFit::MsgLevel level, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg())
Add a message logging stream for message with given RooFit::MsgLevel or higher (i....
RooWorkspace * _debugWorkspace
static Bool_t anyDebug()
Returns true if any debug level stream is active.
Int_t activeStream(const RooAbsArg *self, RooFit::MsgTopic facility, RooFit::MsgLevel level)
Find appropriate logging stream for message from given object with given topic and message level.
virtual ~RooMsgService()
Destructor.
void deleteStream(Int_t id)
Delete stream with given unique ID code.
std::map< std::string, std::ostream * > _files
std::map< int, std::string > _levelNames
void Print(Option_t *options=0) const
Print configuration of message service.
RooFit::MsgLevel _lastMsgLevel
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
The RooWorkspace is a persistable container for RooFit projects.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual int GetPid()
Get process id.
Template specialisation used in RooAbsArg:
RooCmdArg Topic(Int_t topic)
static constexpr double pc
RooFit::MsgLevel minLevel
std::string baseClassName
Bool_t match(RooFit::MsgLevel level, RooFit::MsgTopic facility, const RooAbsArg *obj)
Determine if message from given object at given level on given topic is logged.