Ceylan::Log::LogHolder Class Reference

#include <CeylanLogHolder.h>

Inheritance diagram for Ceylan::Log::LogHolder:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::Log::LogHolder:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 LogHolder (Ceylan::Uint16 argCount, const char *const arguments[], bool immediateWrite=true)
 Creates a LogHolder.
virtual ~LogHolder () throw ()
 Basic virtual destructor.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns a user-friendly description of the state of this object.

Static Public Member Functions

static bool IsAKnownPlugOption (const std::string &option)
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Static Public Attributes

static const std::string ConsolePlugOption = "--consolePlug"
 Command-line option which is to be used to select the console plug.
static const std::string ClassicalPlugOption = "--classicalPlug"
 Command-line option which is to be used to select the classical plug, which is the default plug.
static const std::string HTMLPlugOption = "--HTMLPlug"
 Command-line option which is to be used to select the HTML plug.
static const std::string NullPlugOption = "--nullPlug"
 Command-line option which is to be used to select the null plug.
static KnownPlugs DefaultPlug = classicalPlug
 The default plug, chosen if no specific plug is requested thanks to command-line parameters.

Protected Attributes

KnownPlugs _chosenPlug
 Records the chosen plug, in order to be able to stop it.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 LogHolder (const LogHolder &source)
 Copy constructor made private to ensure that it will be never called.
LogHolderoperator= (const LogHolder &source)
 Assignment operator made private to ensure that it will be never called.


Detailed Description

Definition at line 130 of file CeylanLogHolder.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

LogHolder::LogHolder ( Ceylan::Uint16  argCount,
const char *const   arguments[],
bool  immediateWrite = true 
)

Creates a LogHolder.

Reads the command-line arguments, and uses them to choose a specific LogPlug, if specified, otherwise uses default log plug.

Command-line parameters are left untouched (read-only).

Only the first log plug specification found in command-line is taken into account.

Parameters:
argCount the number of arguments (argc).
arguments the arguments themselves (argv).
immediateWrite if true, selects immediate write for the selected plug, if supported (this is the case of the console and the classical plug, but not for the HTML one); otherwise (if false), deferred writes will be performed (if the plug supports it).
Note:
There is no point in using more than one instance of LogHolder in a process.
Exceptions:
LogException if the log system could not be correctly started.

Definition at line 74 of file CeylanLogHolder.cc.

References _chosenPlug, CEYLAN_LOG, Ceylan::Log::classicalPlug, ClassicalPlugOption, Ceylan::Log::consolePlug, ConsolePlugOption, dataUtils::e, Ceylan::emergencyShutdown(), Ceylan::Log::LogPlug::GetSpeakerNameFrom(), Ceylan::TextDisplayable::html, Ceylan::Log::HTMLPlug, HTMLPlugOption, Ceylan::Log::nullPlug, NullPlugOption, Ceylan::TextDisplayable::rawText, Ceylan::Log::LogPlug::SetFullExecutablePath(), Ceylan::TextDisplayable::SetOutputFormat(), Ceylan::Log::LogPlugNull::StartService(), Ceylan::Log::LogPlugHTML::StartService(), Ceylan::Log::LogPlugClassical::StartService(), Ceylan::Log::LogPlugConsole::StartService(), and Ceylan::Exception::toString().

LogHolder::~LogHolder (  )  throw () [virtual]

Ceylan::Log::LogHolder::LogHolder ( const LogHolder source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

bool LogHolder::IsAKnownPlugOption ( const std::string &  option  )  [static]

LogHolder& Ceylan::Log::LogHolder::operator= ( const LogHolder source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by LogHolder().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string LogHolder::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns a user-friendly description of the state of this object.

See also:
TextDisplayable, Displayable

Ceylan::VerbosityLevels

Implements Ceylan::TextDisplayable.

Definition at line 212 of file CeylanLogHolder.cc.

References _chosenPlug, Ceylan::Log::classicalPlug, Ceylan::Log::consolePlug, Ceylan::Log::HTMLPlug, and Ceylan::Log::nullPlug.


Member Data Documentation

Records the chosen plug, in order to be able to stop it.

Definition at line 244 of file CeylanLogHolder.h.

Referenced by LogHolder(), toString(), and ~LogHolder().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

const string LogHolder::ClassicalPlugOption = "--classicalPlug" [static]

Command-line option which is to be used to select the classical plug, which is the default plug.

Definition at line 215 of file CeylanLogHolder.h.

Referenced by IsAKnownPlugOption(), and LogHolder().

const string LogHolder::ConsolePlugOption = "--consolePlug" [static]

Command-line option which is to be used to select the console plug.

Definition at line 207 of file CeylanLogHolder.h.

Referenced by IsAKnownPlugOption(), and LogHolder().

KnownPlugs LogHolder::DefaultPlug = classicalPlug [static]

The default plug, chosen if no specific plug is requested thanks to command-line parameters.

Definition at line 237 of file CeylanLogHolder.h.

const string LogHolder::HTMLPlugOption = "--HTMLPlug" [static]

Command-line option which is to be used to select the HTML plug.

Definition at line 222 of file CeylanLogHolder.h.

Referenced by IsAKnownPlugOption(), and LogHolder().

const string LogHolder::NullPlugOption = "--nullPlug" [static]

Command-line option which is to be used to select the null plug.

Definition at line 229 of file CeylanLogHolder.h.

Referenced by IsAKnownPlugOption(), and LogHolder().


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

Generated on Thu Jun 4 20:40:26 2009 for Ceylan by  doxygen 1.5.8