Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
WsLogWriter Class Reference

LogWriter, writes logs to file or screen. More...

#include <WsLogWriter.h>

Collaboration diagram for WsLogWriter:
Collaboration graph

Public Member Functions

void write (const int &level, const std::string &message)
 writes the message to the log file More...
 
 ~WsLogWriter ()
 

Static Public Member Functions

static WsLogWriterinstance ()
 returns the instance of the WsLogWriter class. If no instance is existing, a new instance will be returned More...
 

Protected Member Functions

 WsLogWriter ()
 Constructor. More...
 
std::string toString (int level)
 Converts the log level to string. More...
 
void readConf ()
 reads the conf needed to know log path and verbose level More...
 

Private Attributes

pthread_mutex_t m_mutex
 
std::ofstream m_logfile
 
int m_logLevel
 
std::string m_path
 

Static Private Attributes

static WsLogWriterm_instance = 0
 

Detailed Description

LogWriter, writes logs to file or screen.

Definition at line 30 of file WsLogWriter.h.

Constructor & Destructor Documentation

WsLogWriter::~WsLogWriter ( )

Definition at line 42 of file WsLogWriter.cpp.

WsLogWriter::WsLogWriter ( )
protected

Constructor.

Definition at line 33 of file WsLogWriter.cpp.

Member Function Documentation

WsLogWriter * WsLogWriter::instance ( )
static

returns the instance of the WsLogWriter class. If no instance is existing, a new instance will be returned

Definition at line 26 of file WsLogWriter.cpp.

Here is the caller graph for this function:

void WsLogWriter::readConf ( )
protected

reads the conf needed to know log path and verbose level

Definition at line 104 of file WsLogWriter.cpp.

Here is the call graph for this function:

string WsLogWriter::toString ( int  level)
protected

Converts the log level to string.

Parameters
levelthe log level

Definition at line 49 of file WsLogWriter.cpp.

void WsLogWriter::write ( const int &  level,
const std::string &  message 
)

writes the message to the log file

message the message to write level the log level

Definition at line 64 of file WsLogWriter.cpp.

Here is the caller graph for this function:

Member Data Documentation

WsLogWriter * WsLogWriter::m_instance = 0
staticprivate

Definition at line 67 of file WsLogWriter.h.

std::ofstream WsLogWriter::m_logfile
private

Definition at line 69 of file WsLogWriter.h.

int WsLogWriter::m_logLevel
private

Definition at line 70 of file WsLogWriter.h.

pthread_mutex_t WsLogWriter::m_mutex
private

Definition at line 68 of file WsLogWriter.h.

std::string WsLogWriter::m_path
private

Definition at line 71 of file WsLogWriter.h.


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