Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ITraceMng Class Referenceabstract

Trace manager interface. More...

#include <arccore/trace/ITraceMng.h>

Public Member Functions

virtual TraceMessage error ()=0
 Stream for an error message.
virtual TraceMessage perror ()=0
 Stream for a parallel error message.
virtual TraceMessage fatal ()=0
 Stream for a fatal error message.
virtual TraceMessage pfatal ()=0
 Stream for a parallel fatal error message.
virtual TraceMessage warning ()=0
 Stream for a warning message.
virtual TraceMessage pwarning ()=0
 Stream for a parallel warning message.
virtual TraceMessage info ()=0
 Stream for an information message.
virtual TraceMessage pinfo ()=0
 Stream for a parallel information message.
virtual TraceMessage info (char category)=0
 Stream for an information message of a given category.
virtual TraceMessage info (Int32 level)=0
 Stream for an information message of a given level.
virtual TraceMessage pinfo (char category)=0
 Stream for a parallel information message of a given category.
virtual TraceMessage info (bool)=0
 Stream for a conditional information message.
virtual TraceMessage log ()=0
 Stream for a log message.
virtual TraceMessage plog ()=0
 Stream for a parallel log message.
virtual TraceMessage logdate ()=0
 Stream for a log message preceded by the time.
virtual TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium)=0
 Stream for a debug message.
virtual TraceMessage devNull ()=0
 Stream for an unused message.
virtual ARCCORE_DEPRECATED_2018 bool setActivated (bool v)
virtual bool setInfoActivated (bool v)=0
 Modifies the activation state of info messages.
virtual bool isInfoActivated () const =0
 Indicates if info message outputs are activated.
virtual void finishInitialize ()=0
 Finishes initialization.
virtual void pushTraceClass (const String &name)=0
 Adds class s to the stack of active message classes. \threadsafe.
virtual void popTraceClass ()=0
 Removes the last message class from the stack. \threadsafe.
virtual void flush ()=0
 Flushes all streams.
virtual ARCCORE_DEPRECATED_2018 void setRedirectStream (std::ostream *o)=0
 Redirects all messages to the stream o.
virtual void setRedirectStream (ITraceStream *o)=0
 Redirects all messages to the stream o.
virtual Trace::eDebugLevel configDbgLevel () const =0
 Returns the dbg level of the configuration file.
virtual void addListener (ITraceMessageListener *v)=0
 Adds observer v to this message manager.
virtual void removeListener (ITraceMessageListener *v)=0
 Removes observer v from this message manager.
virtual void setTraceId (const String &id)=0
 Sets the manager identifier.
virtual const StringtraceId () const =0
 Manager identifier.
virtual void setErrorFileName (const String &file_name)=0
 Sets the error file name to file_name.
virtual void setLogFileName (const String &file_name)=0
 Sets the log file name to file_name.
virtual void beginTrace (const TraceMessage *message)=0
 Signals the start of writing message message.
virtual void endTrace (const TraceMessage *message)=0
 Signals the end of writing message message.
virtual void putTrace (const String &message, int type)=0
 Directly sends a message of type type.
virtual void setClassConfig (const String &name, const TraceClassConfig &config)=0
 Sets the configuration for the message class name.
virtual TraceClassConfig classConfig (const String &name) const =0
 Configuration associated with the message class name.
virtual void setMaster (bool is_master)=0
 Sets the 'master' state of the instance.
virtual bool isMaster () const =0
virtual void setVerbosityLevel (Int32 level)=0
 Sets the verbosity level of the outputs.
virtual Int32 verbosityLevel () const =0
 Message verbosity level.
virtual void setStandardOutputVerbosityLevel (Int32 level)=0
 Sets the verbosity level of outputs on std::cout.
virtual Int32 standardOutputVerbosityLevel () const =0
 Message verbosity level on std::cout.
virtual void resetThreadStatus ()=0
virtual void writeDirect (const TraceMessage *msg, const String &str)=0
 Writes a message directly.
virtual void removeAllClassConfig ()=0
 Removes all configuration classes set via setClassConfig().
virtual void visitClassConfigs (IFunctorWithArgumentT< std::pair< String, TraceClassConfig > > *functor)=0
void fatalMessage (const StandaloneTraceMessage &o)
 Performs a fatal() on an already manufactured message.

Detailed Description

Trace manager interface.

An instance of this class manages trace streams. To send a message, simply call the corresponding method (info() for an information message, error() for an error, ...) to retrieve a stream and use the << operator on this stream to transmit a message.

For example:

ITraceMng* tr = ...;
tr->info() << "This is an information message.";
int proc_id = 0;
tr->error() << "Error on processor " << proc_id;
virtual TraceMessage error()=0
Stream for an error message.
virtual TraceMessage info()=0
Stream for an information message.

The message is sent upon destruction of the stream. In the previous examples, the streams are temporarily created (by the info() method) and destroyed as soon as the << operator has been applied to them.

Warning
It is absolutely necessary to call the finishInitialize() method before using the calls to the pushTraceClass() and popTraceClass() methods.

If you want to send a message in several parts, you must store the returned stream:

TraceMessage info = m_trace_mng->info();
info() << "Start of information.\n"
info() << "End of information.";

It is possible to use simple formatters on messages (via the TraceMessage class) or standard iostream formatters by applying the operator() operator of TraceMessage.

Instances of this class are managed by a reference counter. It is preferable to keep instances in a ReferenceCounter.

Definition at line 174 of file arccore/src/trace/arccore/trace/ITraceMng.h.

Member Function Documentation

◆ addListener()

virtual void Arcane::ITraceMng::addListener ( ITraceMessageListener * v)
pure virtual

Adds observer v to this message manager.

The caller remains the owner of v and must remove it via removeListener() before destroying it.

Implemented in Arcane::TraceMng.

◆ beginTrace()

virtual void Arcane::ITraceMng::beginTrace ( const TraceMessage * message)
pure virtual

Signals the start of writing message message.

Implemented in Arcane::TraceMng.

◆ classConfig()

virtual TraceClassConfig Arcane::ITraceMng::classConfig ( const String & name) const
pure virtual

Configuration associated with the message class name.

Implemented in Arcane::TraceMng.

◆ configDbgLevel()

virtual Trace::eDebugLevel Arcane::ITraceMng::configDbgLevel ( ) const
pure virtual

Returns the dbg level of the configuration file.

Implemented in Arcane::TraceMng.

◆ debug()

◆ devNull()

virtual TraceMessage Arcane::ITraceMng::devNull ( )
pure virtual

Stream for an unused message.

Implemented in Arcane::TraceMng.

◆ endTrace()

virtual void Arcane::ITraceMng::endTrace ( const TraceMessage * message)
pure virtual

Signals the end of writing message message.

Implemented in Arcane::TraceMng.

◆ error()

◆ fatal()

◆ fatalMessage()

void Arcane::ITraceMng::fatalMessage ( const StandaloneTraceMessage & o)

Performs a fatal() on an already manufactured message.

This method allows writing code equivalent to:

fatal() << "MyMessage";
virtual TraceMessage fatal()=0
Stream for a fatal error message.

like this:

void fatalMessage(const StandaloneTraceMessage &o)
Performs a fatal() on an already manufactured message.
Management of a standalone message.

This second solution allows signaling to the compiler that the method will not return and thus avoid certain compilation warnings.

Definition at line 1333 of file arccore/src/trace/arccore/trace/TraceMng.cc.

References ARCCORE_FATAL.

Referenced by visitClassConfigs().

◆ finishInitialize()

virtual void Arcane::ITraceMng::finishInitialize ( )
pure virtual

Finishes initialization.

Implemented in Arcane::TraceMng.

◆ flush()

virtual void Arcane::ITraceMng::flush ( )
pure virtual

Flushes all streams.

Implemented in Arcane::TraceMng.

◆ info() [1/4]

◆ info() [2/4]

virtual TraceMessage Arcane::ITraceMng::info ( bool )
pure virtual

Stream for a conditional information message.

Implemented in Arcane::TraceMng.

◆ info() [3/4]

virtual TraceMessage Arcane::ITraceMng::info ( char category)
pure virtual

Stream for an information message of a given category.

Implemented in Arcane::TraceMng.

◆ info() [4/4]

virtual TraceMessage Arcane::ITraceMng::info ( Int32 level)
pure virtual

Stream for an information message of a given level.

Implemented in Arcane::TraceMng.

◆ isInfoActivated()

virtual bool Arcane::ITraceMng::isInfoActivated ( ) const
pure virtual

Indicates if info message outputs are activated.

Implemented in Arcane::TraceMng.

◆ log()

virtual TraceMessage Arcane::ITraceMng::log ( )
pure virtual

Stream for a log message.

Implemented in Arcane::TraceMng.

◆ logdate()

virtual TraceMessage Arcane::ITraceMng::logdate ( )
pure virtual

Stream for a log message preceded by the time.

Implemented in Arcane::TraceMng.

◆ perror()

virtual TraceMessage Arcane::ITraceMng::perror ( )
pure virtual

Stream for a parallel error message.

Implemented in Arcane::TraceMng.

◆ pfatal()

virtual TraceMessage Arcane::ITraceMng::pfatal ( )
pure virtual

Stream for a parallel fatal error message.

Implemented in Arcane::TraceMng.

◆ pinfo() [1/2]

virtual TraceMessage Arcane::ITraceMng::pinfo ( )
pure virtual

Stream for a parallel information message.

Implemented in Arcane::TraceMng.

◆ pinfo() [2/2]

virtual TraceMessage Arcane::ITraceMng::pinfo ( char category)
pure virtual

Stream for a parallel information message of a given category.

Implemented in Arcane::TraceMng.

◆ plog()

virtual TraceMessage Arcane::ITraceMng::plog ( )
pure virtual

Stream for a parallel log message.

Implemented in Arcane::TraceMng.

◆ popTraceClass()

virtual void Arcane::ITraceMng::popTraceClass ( )
pure virtual

Removes the last message class from the stack. \threadsafe.

Implemented in Arcane::TraceMng.

◆ pushTraceClass()

virtual void Arcane::ITraceMng::pushTraceClass ( const String & name)
pure virtual

Adds class s to the stack of active message classes. \threadsafe.

Implemented in Arcane::TraceMng.

◆ putTrace()

virtual void Arcane::ITraceMng::putTrace ( const String & message,
int type )
pure virtual

Directly sends a message of type type.

type must correspond to Trace::eMessageType. This method should only be used by the .NET wrapping.

Implemented in Arcane::TraceMng.

◆ pwarning()

virtual TraceMessage Arcane::ITraceMng::pwarning ( )
pure virtual

Stream for a parallel warning message.

Implemented in Arcane::TraceMng.

Referenced by Arcane::Hdf5VariableInfoBase::writeGroup().

◆ removeAllClassConfig()

virtual void Arcane::ITraceMng::removeAllClassConfig ( )
pure virtual

Removes all configuration classes set via setClassConfig().

Implemented in Arcane::TraceMng.

◆ removeListener()

virtual void Arcane::ITraceMng::removeListener ( ITraceMessageListener * v)
pure virtual

Removes observer v from this message manager.

Implemented in Arcane::TraceMng.

◆ setActivated()

virtual ARCCORE_DEPRECATED_2018 bool Arcane::ITraceMng::setActivated ( bool v)
inlinevirtual

◆ setClassConfig()

virtual void Arcane::ITraceMng::setClassConfig ( const String & name,
const TraceClassConfig & config )
pure virtual

Sets the configuration for the message class name.

Implemented in Arcane::TraceMng.

◆ setErrorFileName()

virtual void Arcane::ITraceMng::setErrorFileName ( const String & file_name)
pure virtual

Sets the error file name to file_name.

If an error file is already open, it is closed and a new one with this new file name will be created upon the next error.

If file_name is the null string, no error file is used.

Implemented in Arcane::TraceMng.

◆ setInfoActivated()

virtual bool Arcane::ITraceMng::setInfoActivated ( bool v)
pure virtual

Modifies the activation state of info messages.

Returns
the previous activation state.

Implemented in Arcane::TraceMng.

Referenced by setActivated().

◆ setLogFileName()

virtual void Arcane::ITraceMng::setLogFileName ( const String & file_name)
pure virtual

Sets the log file name to file_name.

If a log file is already open, it is closed and a new one with this new file name will be created upon the next log.

If file_name is the null string, no log file is used.

Implemented in Arcane::TraceMng.

◆ setMaster()

virtual void Arcane::ITraceMng::setMaster ( bool is_master)
pure virtual

Sets the 'master' state of the instance.

Instances that have this attribute set to true display messages on std::cout as well as the messages perror() and pwarning(). It is therefore preferable that there be only one master ITraceMng instance.

Implemented in Arcane::TraceMng.

◆ setRedirectStream() [1/2]

virtual void Arcane::ITraceMng::setRedirectStream ( ITraceStream * o)
pure virtual

Redirects all messages to the stream o.

Implemented in Arcane::TraceMng.

◆ setRedirectStream() [2/2]

virtual ARCCORE_DEPRECATED_2018 void Arcane::ITraceMng::setRedirectStream ( std::ostream * o)
pure virtual

Redirects all messages to the stream o.

Deprecated
Use the setRedirectStream(ITraceStream*) overload.

Implemented in Arcane::TraceMng.

◆ setStandardOutputVerbosityLevel()

virtual void Arcane::ITraceMng::setStandardOutputVerbosityLevel ( Int32 level)
pure virtual

Sets the verbosity level of outputs on std::cout.

This property is only used if isMaster() is true and if the listings outputs have been redirected. Otherwise, the property verbosityLevel() is used.

Implemented in Arcane::TraceMng.

◆ setTraceId()

virtual void Arcane::ITraceMng::setTraceId ( const String & id)
pure virtual

Sets the manager identifier.

If not null, the identifier is displayed in case of an error to identify the instance displaying the message. The identifier can be arbitrary. By default, it is the process rank and the machine name.

Implemented in Arcane::TraceMng.

◆ setVerbosityLevel()

virtual void Arcane::ITraceMng::setVerbosityLevel ( Int32 level)
pure virtual

Sets the verbosity level of the outputs.

Messages at a level higher than this level are not outputted. The level used is the one given as an argument to info(Int32). The default level is the one given by TraceMessage::DEFAULT_LEVEL.

Implemented in Arcane::TraceMng.

◆ standardOutputVerbosityLevel()

virtual Int32 Arcane::ITraceMng::standardOutputVerbosityLevel ( ) const
pure virtual

Message verbosity level on std::cout.

Implemented in Arcane::TraceMng.

◆ traceId()

virtual const String & Arcane::ITraceMng::traceId ( ) const
pure virtual

Manager identifier.

Implemented in Arcane::TraceMng.

◆ verbosityLevel()

virtual Int32 Arcane::ITraceMng::verbosityLevel ( ) const
pure virtual

Message verbosity level.

Implemented in Arcane::TraceMng.

◆ visitClassConfigs()

virtual void Arcane::ITraceMng::visitClassConfigs ( IFunctorWithArgumentT< std::pair< String, TraceClassConfig > > * functor)
pure virtual

\biref Applies the functor functor to all registered TraceClassConfig.

The first argument of the pair is the configuration class name and the second is its value as returned by classConfig().

It is permitted to modify the TraceClassConfig during visitation via a call to setClassConfig().

Implemented in Arcane::TraceMng.

References fatalMessage().

◆ warning()

virtual TraceMessage Arcane::ITraceMng::warning ( )
pure virtual

Stream for a warning message.

Implemented in Arcane::TraceMng.

◆ writeDirect()

virtual void Arcane::ITraceMng::writeDirect ( const TraceMessage * msg,
const String & str )
pure virtual

Writes a message directly.

Directly writes message msg containing string buf_array. The message is not analyzed by the instance and is always written without any specific formatting. This operation should in principle only be used by an ITraceMessageListener. For other cases, standard traces must be used.

Implemented in Arcane::TraceMng.


The documentation for this class was generated from the following files: