ROSE  0.11.96.11
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Sawyer::Message::Prefix Class Reference

Description

Information printed at the beginning of each free-format message.

Definition at line 986 of file Message.h.

#include <Message.h>

Inheritance diagram for Sawyer::Message::Prefix:
Inheritance graph
[legend]
Collaboration diagram for Sawyer::Message::Prefix:
Collaboration graph
[legend]

Public Types

enum  When {
  NEVER =0,
  SOMETIMES =1,
  ALWAYS =2
}
 When to show something. More...
 

Public Member Functions

void setProgramName ()
 Reset the program name from operating system information. More...
 
void setStartTime ()
 Reset the start time from operating system information. More...
 
virtual std::string toString (const Mesg &, const MesgProps &) const
 Return a prefix string. More...
 
const ColorSetcolorSet () const
 Property: colors to use for the prefix if coloring is enabled. More...
 
ColorSetcolorSet ()
 Property: colors to use for the prefix if coloring is enabled. More...
 
const Optional< std::string > & programName () const
 Property: program name. More...
 
PrefixPtr programName (const std::string &s)
 Property: program name. More...
 
bool showProgramName () const
 Property: whether to show the program name in the message prefix area. More...
 
PrefixPtr showProgramName (bool b)
 Property: whether to show the program name in the message prefix area. More...
 
bool showThreadId () const
 Property: whether to show the thread ID in the message prefix area. More...
 
PrefixPtr showThreadId (bool b)
 Property: whether to show the thread ID in the message prefix area. More...
 
const Optional< double > startTime () const
 Property: start time when emitting time deltas. More...
 
PrefixPtr startTime (double t)
 Property: start time when emitting time deltas. More...
 
bool showElapsedTime () const
 Property: whether to show time deltas. More...
 
PrefixPtr showElapsedTime (bool b)
 Property: whether to show time deltas. More...
 
When showFacilityName () const
 Property: whether to show the facilityName property. More...
 
PrefixPtr showFacilityName (When w)
 Property: whether to show the facilityName property. More...
 
bool showImportance () const
 Property: whether to show the importance property. More...
 
PrefixPtr showImportance (bool b)
 Property: whether to show the importance property. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 
- Public Member Functions inherited from Sawyer::SharedFromThis< Prefix >
SharedPointer< Prefix > sharedFromThis ()
 Create a shared pointer from this. More...
 
SharedPointer< const Prefix > sharedFromThis () const
 Create a shared pointer from this. More...
 

Static Public Member Functions

static PrefixPtr instance ()
 Allocating constructor. More...
 
static PrefixPtr silentInstance ()
 Construct a prefix that is silent. More...
 

Protected Member Functions

 Prefix ()
 Constructor for derived classes. More...
 

Member Enumeration Documentation

◆ When

When to show something.

Enumerator
NEVER 

Never show this item.

SOMETIMES 

Show this item only sometimes (depends on the item).

ALWAYS 

Always show this item.

Definition at line 990 of file Message.h.

Constructor & Destructor Documentation

◆ Prefix()

Sawyer::Message::Prefix::Prefix ( )
inlineprotected

Constructor for derived classes.

Non-subclass users should use instance instead.

Definition at line 1011 of file Message.h.

References Sawyer::Message::ColorSet::fullColor().

Here is the call graph for this function:

Member Function Documentation

◆ instance()

static PrefixPtr Sawyer::Message::Prefix::instance ( )
inlinestatic

Allocating constructor.

Creates a new prefix instance and returns a pointer to it. The new object is initialized with information about the thread that created it, such as program name, thread ID, time of creation, etc.

Definition at line 1024 of file Message.h.

Referenced by Sawyer::Message::UnformattedSink::UnformattedSink().

Here is the caller graph for this function:

◆ silentInstance()

static PrefixPtr Sawyer::Message::Prefix::silentInstance ( )
static

Construct a prefix that is silent.

Constructs a prefix whose output properties are all false, thus producing no output.

◆ colorSet() [1/2]

const ColorSet& Sawyer::Message::Prefix::colorSet ( ) const
inline

Property: colors to use for the prefix if coloring is enabled.

Colors can be specified even for sinks that don't support them–they just won't be used.

Thread safety: Not thread-safe.

Definition at line 1038 of file Message.h.

◆ colorSet() [2/2]

ColorSet& Sawyer::Message::Prefix::colorSet ( )
inline

Property: colors to use for the prefix if coloring is enabled.

Colors can be specified even for sinks that don't support them–they just won't be used.

Thread safety: Not thread-safe.

Definition at line 1039 of file Message.h.

◆ programName() [1/2]

const Optional<std::string>& Sawyer::Message::Prefix::programName ( ) const
inline

Property: program name.

The default is the base name of the file that was executed. An "lt-" prefix is removed from the base name since this is typically added by libtool and doesn't correspond to the name that the user executed.

Thread safety: Not thread safe.

See also
setProgramName showProgramName

Definition at line 1052 of file Message.h.

◆ programName() [2/2]

PrefixPtr Sawyer::Message::Prefix::programName ( const std::string &  s)
inline

Property: program name.

The default is the base name of the file that was executed. An "lt-" prefix is removed from the base name since this is typically added by libtool and doesn't correspond to the name that the user executed.

Thread safety: Not thread safe.

See also
setProgramName showProgramName

Definition at line 1053 of file Message.h.

◆ setProgramName()

void Sawyer::Message::Prefix::setProgramName ( )

Reset the program name from operating system information.

Thread safety: This method is thread-safe.

See also
programName showProgramName

◆ showProgramName() [1/2]

bool Sawyer::Message::Prefix::showProgramName ( ) const
inline

Property: whether to show the program name in the message prefix area.

The default is true.

Thread safety: This method is not thread-safe.

See also
programName

Definition at line 1071 of file Message.h.

◆ showProgramName() [2/2]

PrefixPtr Sawyer::Message::Prefix::showProgramName ( bool  b)
inline

Property: whether to show the program name in the message prefix area.

The default is true.

Thread safety: This method is not thread-safe.

See also
programName

Definition at line 1072 of file Message.h.

◆ showThreadId() [1/2]

bool Sawyer::Message::Prefix::showThreadId ( ) const
inline

Property: whether to show the thread ID in the message prefix area.

The default is true.

Thread safety: This method is not thread-safe.

Definition at line 1082 of file Message.h.

◆ showThreadId() [2/2]

PrefixPtr Sawyer::Message::Prefix::showThreadId ( bool  b)
inline

Property: whether to show the thread ID in the message prefix area.

The default is true.

Thread safety: This method is not thread-safe.

Definition at line 1083 of file Message.h.

◆ startTime() [1/2]

const Optional<double> Sawyer::Message::Prefix::startTime ( ) const

Property: start time when emitting time deltas.

On some systems the start time will be the time at which this object was created.

Thread safety: This method is not thread-safe.

See also
setStartTime showElapsedTime

◆ startTime() [2/2]

PrefixPtr Sawyer::Message::Prefix::startTime ( double  t)

Property: start time when emitting time deltas.

On some systems the start time will be the time at which this object was created.

Thread safety: This method is not thread-safe.

See also
setStartTime showElapsedTime

◆ setStartTime()

void Sawyer::Message::Prefix::setStartTime ( )

Reset the start time from operating system information.

On some systems this will be the time at which the first prefix object was created rather than the time the operating system created the main process.

Thread safety: This method is not thread-safe.

See also
startTime showElapsedTime

◆ showElapsedTime() [1/2]

bool Sawyer::Message::Prefix::showElapsedTime ( ) const
inline

Property: whether to show time deltas.

Time deltas are displayed as fractional seconds since some starting time.

Thread safety: This method is not thread-safe.

See also
startTime setStartTime

Definition at line 1117 of file Message.h.

◆ showElapsedTime() [2/2]

PrefixPtr Sawyer::Message::Prefix::showElapsedTime ( bool  b)
inline

Property: whether to show time deltas.

Time deltas are displayed as fractional seconds since some starting time.

Thread safety: This method is not thread-safe.

See also
startTime setStartTime

Definition at line 1118 of file Message.h.

◆ showFacilityName() [1/2]

When Sawyer::Message::Prefix::showFacilityName ( ) const
inline

Property: whether to show the facilityName property.

When set to SOMETIMES, the facility name is shown when it differs from the program name and the program name has been shown. In any case, the facility name is not shown if it has no value.

Thread safety: This method is not thread-safe.

Definition at line 1129 of file Message.h.

◆ showFacilityName() [2/2]

PrefixPtr Sawyer::Message::Prefix::showFacilityName ( When  w)
inline

Property: whether to show the facilityName property.

When set to SOMETIMES, the facility name is shown when it differs from the program name and the program name has been shown. In any case, the facility name is not shown if it has no value.

Thread safety: This method is not thread-safe.

Definition at line 1130 of file Message.h.

◆ showImportance() [1/2]

bool Sawyer::Message::Prefix::showImportance ( ) const
inline

Property: whether to show the importance property.

In any case, the importance level is not shown if it has no value.

Thread safety: This method is not thread-safe.

Definition at line 1140 of file Message.h.

◆ showImportance() [2/2]

PrefixPtr Sawyer::Message::Prefix::showImportance ( bool  b)
inline

Property: whether to show the importance property.

In any case, the importance level is not shown if it has no value.

Thread safety: This method is not thread-safe.

Definition at line 1141 of file Message.h.

◆ toString()

virtual std::string Sawyer::Message::Prefix::toString ( const Mesg ,
const MesgProps  
) const
virtual

Return a prefix string.

Generates a string from this prefix object.

Thread safety: This method is not thread-safe.


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