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

Static Public Member Functions

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

Protected Member Functions

 Prefix ()
 Constructor for derived classes.
 

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.

◆ ~Prefix()

virtual Sawyer::Message::Prefix::~Prefix ( )
inlinevirtual

Definition at line 1018 of file Message.h.

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.

◆ 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: