Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions | Static Public Member Functions | Friends

ball::LoggerManagerConfiguration Class Reference

#include <ball_loggermanagerconfiguration.h>

List of all members.

Public Types

enum  LogOrder {
  e_FIFO, e_LIFO, BAEL_FIFO = e_FIFO, BAEL_LIFO = e_LIFO,
  FIFO = e_FIFO, LIFO = e_LIFO
}
enum  TriggerMarkers {
  e_NO_MARKERS, e_BEGIN_END_MARKERS, BAEL_NO_MARKERS = e_NO_MARKERS, BAEL_BEGIN_END_MARKERS = e_BEGIN_END_MARKERS,
  NO_MARKERS = e_NO_MARKERS, BEGIN_END_MARKERS = e_BEGIN_END_MARKERS
}
typedef bsl::function< void(ball::UserFields *) UserFieldsPopulatorCallback )
typedef bsl::function< void(bsl::string
*, const char *) 
CategoryNameFilterCallback )
typedef bsl::function< void(int
*, int *, int *, int *, const
char *) 
DefaultThresholdLevelsCallback )

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (LoggerManagerConfiguration, bslma::UsesBslmaAllocator)
 LoggerManagerConfiguration (bslma::Allocator *basicAllocator=0)
 LoggerManagerConfiguration (const LoggerManagerConfiguration &original, bslma::Allocator *basicAllocator=0)
 ~LoggerManagerConfiguration ()
LoggerManagerConfigurationoperator= (const LoggerManagerConfiguration &rhs)
void setDefaultValues (const LoggerManagerDefaults &defaults)
int setDefaultRecordBufferSizeIfValid (int numBytes)
int setDefaultLoggerBufferSizeIfValid (int numBytes)
int setDefaultThresholdLevelsIfValid (int passLevel)
int setDefaultThresholdLevelsIfValid (int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
void setUserFieldsPopulatorCallback (const UserFieldsPopulatorCallback &populatorCallback)
void setCategoryNameFilterCallback (const CategoryNameFilterCallback &nameFilter)
void setDefaultThresholdLevelsCallback (const DefaultThresholdLevelsCallback &thresholdsCb)
void setLogOrder (LogOrder value)
void setTriggerMarkers (TriggerMarkers value)
const LoggerManagerDefaultsdefaults () const
int defaultRecordBufferSize () const
int defaultLoggerBufferSize () const
int defaultRecordLevel () const
int defaultPassLevel () const
int defaultTriggerLevel () const
int defaultTriggerAllLevel () const
const UserFieldsPopulatorCallbackuserFieldsPopulatorCallback () const
const CategoryNameFilterCallbackcategoryNameFilterCallback () const
const
DefaultThresholdLevelsCallback
defaultThresholdLevelsCallback () const
LogOrder logOrder () const
TriggerMarkers triggerMarkers () const
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const

Static Public Member Functions

static bool isValidDefaultRecordBufferSize (int numBytes)
static bool isValidDefaultLoggerBufferSize (int numBytes)
static bool areValidDefaultThresholdLevels (int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)

Friends

bsl::ostream & operator<< (bsl::ostream &, const LoggerManagerConfiguration &)
bool operator== (const LoggerManagerConfiguration &, const LoggerManagerConfiguration &)

Detailed Description

This class provides constrained configuration parameters for a logger manager. The constraints are maintained as class invariants; it is not possible to obtain an invalid object through this interface.

This class support in-core value-semantic operations, including copy construction, assignment, and equality comparison; ostream printing is supported, but in a modified form to handle functors, and BDEX serialization cannot be supported at all. (A precise operational definition of when two instances have the same (in-core) value can be found in the description of operator== for the class.) This class is exception neutral with no guarantee of rollback: If an exception is thrown during the invocation of a method on a pre-existing instance, the object is left in a valid state, but its value is undefined. In no event is memory leaked. Finally, aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases.

See Component ball_loggermanagerconfiguration


Member Typedef Documentation

UserFieldsPopulatorCallback is the type of a user-supplied callback functor used to populate the user-defined fields in each log record.

CategoryNameFilterCallback is the type of the user-supplied functor that translates external category names to internal names.

typedef bsl::function<void(int *, int *, int *, int *, const char *) ball::LoggerManagerConfiguration::DefaultThresholdLevelsCallback)

DefaultThresholdLevelsCallback is the type of the functor that determines default threshold levels for categories added to the registry by the setCategory(const char *) method.


Member Enumeration Documentation

The LogOrder enumeration defines the order in which messages will be published to the underlying observer in the case of Trigger and Trigger-All events.

Enumerator:
e_FIFO 

oldest logged messages are published first

e_LIFO 

newest logged messages are published first

BAEL_FIFO 
BAEL_LIFO 
FIFO 
LIFO 

The TriggerMarkers enumeration defines whether text will be written to the log to indicate whether a series of log records were logged due to either a Trigger or Trigger-All event. If this attribute is e_BEGIN_END_MARKERS, then "BEGIN RECORD DUMP" and "END RECORD DUMP" will be written before and after each sequence of records logged due to a Trigger or Trigger-All event. The default value of this attribute is e_BEGIN_END_MARKERS.

Enumerator:
e_NO_MARKERS 

don't print any markers

e_BEGIN_END_MARKERS 

print "BEGIN RECORD DUMP" and "END RECORD DUMP" markers (default)

BAEL_NO_MARKERS 
BAEL_BEGIN_END_MARKERS 
NO_MARKERS 
BEGIN_END_MARKERS 

Constructor & Destructor Documentation

ball::LoggerManagerConfiguration::LoggerManagerConfiguration ( bslma::Allocator basicAllocator = 0  )  [explicit]

Create a logger manager configuration constrained-attribute object having valid default values for all attributes. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

ball::LoggerManagerConfiguration::LoggerManagerConfiguration ( const LoggerManagerConfiguration original,
bslma::Allocator basicAllocator = 0 
)

Create a logger manager configuration constrained-attribute object having the in-core value of the specified original object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

ball::LoggerManagerConfiguration::~LoggerManagerConfiguration (  ) 

Destroy this object.


Member Function Documentation

static bool ball::LoggerManagerConfiguration::isValidDefaultRecordBufferSize ( int  numBytes  )  [static]

Return true if the specified numBytes is a valid default-logger record-buffer size value, and false otherwise. numBytes is valid if 0 < numBytes.

static bool ball::LoggerManagerConfiguration::isValidDefaultLoggerBufferSize ( int  numBytes  )  [static]

Return true if the specified numBytes is a valid default logger-message-buffer size value, and false otherwise. numBytes is valid if 0 < numBytes.

static bool ball::LoggerManagerConfiguration::areValidDefaultThresholdLevels ( int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel 
) [static]

Return true if each of the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel values is a valid default severity threshold level, and false otherwise. Valid severity threshold levels are in the range [0 .. 255].

ball::LoggerManagerConfiguration::BSLMF_NESTED_TRAIT_DECLARATION ( LoggerManagerConfiguration  ,
bslma::UsesBslmaAllocator   
)
LoggerManagerConfiguration& ball::LoggerManagerConfiguration::operator= ( const LoggerManagerConfiguration rhs  ) 

Assign to this logger manager configuration constrained-attribute object the in-core value of the specified rhs object.

void ball::LoggerManagerConfiguration::setDefaultValues ( const LoggerManagerDefaults defaults  ) 

Set the default values attribute of this object to the specified defaults. Note that, since defaults is itself a constrained-attribute object, this method cannot fail.

int ball::LoggerManagerConfiguration::setDefaultRecordBufferSizeIfValid ( int  numBytes  ) 

Set the default-logger record-buffer size attribute of the LoggerManagerDefaults attribute of this object to the specified numBytes if 0 < numBytes. Return 0 on success, and a non-zero value otherwise with no effect on this object.

int ball::LoggerManagerConfiguration::setDefaultLoggerBufferSizeIfValid ( int  numBytes  ) 

Set the default logger-message-buffer size attribute of the LoggerManagerDefaults attribute of this object to the specified numBytes if 0 < numBytes. Return 0 on success, and a non-zero value otherwise with no effect on this object.

int ball::LoggerManagerConfiguration::setDefaultThresholdLevelsIfValid ( int  passLevel  ) 

Set the passthrough severity threshold level attribute of the LoggerManagerDefaults attribute of this object to the specified passLevel, if it is in the range [0 .. 255], and set all the other threshold levels (recordLevel, triggerLevel, triggerAllLevel) to 0. Return 0 on success, and a non-zero value otherwise with no effect on this object.

int ball::LoggerManagerConfiguration::setDefaultThresholdLevelsIfValid ( int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel 
)

Set the quadruplet of default severity threshold level attributes of the LoggerManagerDefaults attribute of this object to the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel values if each level is in the range [0 .. 255]. Return 0 on success, and a non-zero value otherwise with no effect on this object.

void ball::LoggerManagerConfiguration::setUserFieldsPopulatorCallback ( const UserFieldsPopulatorCallback populatorCallback  ) 

Set the user-fields populator callback attribute of this object to the specified populatorCallback.

void ball::LoggerManagerConfiguration::setCategoryNameFilterCallback ( const CategoryNameFilterCallback nameFilter  ) 

Set the category name-filter callback functor attribute of this object to the specified nameFilter. Note that this method cannot fail, and that nameFilter can be a "null" (i.e., unpopulated) functor object.

void ball::LoggerManagerConfiguration::setDefaultThresholdLevelsCallback ( const DefaultThresholdLevelsCallback thresholdsCb  ) 

Set the default thresholds callback functor attribute of this object to the specified thresholdsCb. Note that this method cannot fail, and that thresholdsCb can be a "null" (i.e., unpopulated) functor object.

void ball::LoggerManagerConfiguration::setLogOrder ( LogOrder  value  ) 

Set the log order attribute of this object to the specified value.

void ball::LoggerManagerConfiguration::setTriggerMarkers ( TriggerMarkers  value  ) 

Set the trigger marker attribute of this object to the specified value.

const LoggerManagerDefaults& ball::LoggerManagerConfiguration::defaults (  )  const

Return a reference to the non-modifiable defaults object attribute of this object.

int ball::LoggerManagerConfiguration::defaultRecordBufferSize (  )  const

Return the default-logger record-buffer size attribute of the LoggerManagerDefaults attribute of this object.

int ball::LoggerManagerConfiguration::defaultLoggerBufferSize (  )  const

Return the default logger-message-buffer size attribute of the LoggerManagerDefaults attribute of this object.

int ball::LoggerManagerConfiguration::defaultRecordLevel (  )  const

Return the default Record threshold level attribute of the LoggerManagerDefaults attribute of this object.

int ball::LoggerManagerConfiguration::defaultPassLevel (  )  const

Return the default Pass threshold level attribute of the LoggerManagerDefaults attribute of this object.

int ball::LoggerManagerConfiguration::defaultTriggerLevel (  )  const

Return the default Trigger threshold level attribute of the LoggerManagerDefaults attribute of this object.

int ball::LoggerManagerConfiguration::defaultTriggerAllLevel (  )  const

Return the default Trigger-All threshold level attribute of the LoggerManagerDefaults attribute of this object.

const UserFieldsPopulatorCallback& ball::LoggerManagerConfiguration::userFieldsPopulatorCallback (  )  const

Return a reference providing non-modifiable access to the user-fields populator functor attribute of this object.

const CategoryNameFilterCallback& ball::LoggerManagerConfiguration::categoryNameFilterCallback (  )  const

Return a reference to the non-modifiable category name filter functor attribute of this object.

const DefaultThresholdLevelsCallback& ball::LoggerManagerConfiguration::defaultThresholdLevelsCallback (  )  const

Return a reference to the non-modifiable default severity-level thresholds functor attribute of this object.

LogOrder ball::LoggerManagerConfiguration::logOrder (  )  const

Return the log order attribute of this object. See attributes description for effects of the log order.

TriggerMarkers ball::LoggerManagerConfiguration::triggerMarkers (  )  const

Return the trigger marker attribute of this object. See attributes description for effects of the trigger markers.

bsl::ostream& ball::LoggerManagerConfiguration::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format a reasonable representation of this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, suppress all indentation AND format the entire output on one line. If stream is not valid on entry, this operation has no effect. The format will indicate whether the contained functors are or are not "null", but will not otherwise attempt to represent functor "values".


Friends And Related Function Documentation

bsl::ostream& operator<< ( bsl::ostream &  ,
const LoggerManagerConfiguration  
) [friend]

Write a reasonable representation of the specified configuration object to the specified output stream, indicating whether the contained functors are or are not "null".

bool operator== ( const LoggerManagerConfiguration ,
const LoggerManagerConfiguration  
) [friend]

Return true if the specified lhs and rhs attribute objects have the same (in-core) value, and false otherwise. Two attribute objects objects have the same in-core value if each respective attribute has the same in-core value. Note that functor attributes must have identically the same representation to have the same in-core value.


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