NAGASH 0.9.8
Next Generation Analysis System
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
NAGASH::MSGTool Class Reference

Maniplulate all messages of NAGASH. More...

#include "NAGASH/MSGTool.h"

Inheritance diagram for NAGASH::MSGTool:

Classes

class  MSGTitleGuard
 Used to call MSGTool::EndTitle() automatically. More...
 

Public Member Functions

 MSGTool ()=default
 
 MSGTool (const MSGTool &msg)=delete
 
 MSGTool (const MSGTool &msg, int ThreadNumber)
 Construct sub-MSGTool for multi-thread usage.
 
 MSGTool (MSGLevel level, const TString &name="UNKNOWN")
 Construct MSGTool with given level, message below this level will not be printed.
 
 MSGTool (MSGTool &&msg)=delete
 
 ~MSGTool ()
 
void CloseLog ()
 Close the log file.
 
void CreateLog (const TString &name)
 Create log file with given file name.
 
void EndFocusRegion (const TString &name)
 End focus region.
 
void EndTitle ()
 End the current title.
 
MSGLevel Level () const
 Get the current message level.
 
template<typename... Args>
void MSG (MSGLevel level, Args &&...args)
 Output with given message level. Messages below the level in MSGTool will be ignored.
 
template<typename... Args>
void MSG_DEBUG (Args &&...args)
 Output with DEBUG level. Messages below the level in MSGTool will be ignored.
 
template<typename... Args>
void MSG_ERROR (Args &&...args)
 Output with ERROR level. Messages below the level in MSGTool will be ignored.
 
template<typename... Args>
void MSG_INFO (Args &&...args)
 Output with INFO level. Messages below the level in MSGTool will be ignored.
 
template<typename... Args>
void MSG_WARNING (Args &&...args)
 Output with WARNING level. Messages below the level in MSGTool will be ignored.
 
void OpenLog (const TString &name)
 Open log file with given file name.
 
MSGTooloperator= (const MSGTool &msg)=delete
 
MSGTooloperator= (MSGTool &&msg)=delete
 
MSGLevel SetOutputLevel (MSGLevel level)
 Set the output message level.
 
void StartFocusRegion (const TString &name)
 Start focus region, inside this region the message level would be set to debug.
 
void StartTitle (const TString &name)
 Start a title with given name.
 
std::unique_ptr< MSGTitleGuardStartTitleWithGuard (const TString &title)
 Start a title with given name.
 

Private Member Functions

template<typename... Args>
void Print (Args &&...args)
 
void PrintEnd ()
 
void PrintLevel (MSGLevel level)
 
void PrintSpace ()
 
void PrintTitle ()
 

Private Attributes

MSGLevel DefinedLevel = MSGLevel::INFO
 
TString FocusName = "UNKNOWN"
 
std::vector< TString > FuncTitle
 
bool isCreateLog = false
 
bool isOpenLog = false
 
TString LogFileName
 
std::shared_mutex MSGMutex
 
std::ofstream outfile
 
MSGLevel OutputLevel = MSGLevel::INFO
 
bool tolog = false
 

Friends

class Analysis
 
class ConfigTool
 
class LoopEvent
 

Detailed Description

Maniplulate all messages of NAGASH.

Definition at line 27 of file MSGTool.h.

Constructor & Destructor Documentation

◆ MSGTool() [1/5]

MSGTool::MSGTool ( MSGLevel  level,
const TString &  name = "UNKNOWN" 
)

Construct MSGTool with given level, message below this level will not be printed.

Parameters
levelthe message level.
namethe focus region name.

Definition at line 14 of file MSGTool.cxx.

◆ MSGTool() [2/5]

MSGTool::MSGTool ( const MSGTool msg,
int  ThreadNumber 
)

Construct sub-MSGTool for multi-thread usage.

Parameters
msgthe mother MSGTool.
ThreadNumberthe thread number.

Definition at line 28 of file MSGTool.cxx.

◆ MSGTool() [3/5]

NAGASH::MSGTool::MSGTool ( )
default

◆ MSGTool() [4/5]

NAGASH::MSGTool::MSGTool ( const MSGTool msg)
delete

◆ MSGTool() [5/5]

NAGASH::MSGTool::MSGTool ( MSGTool &&  msg)
delete

◆ ~MSGTool()

MSGTool::~MSGTool ( )

Definition at line 46 of file MSGTool.cxx.

Member Function Documentation

◆ CloseLog()

void MSGTool::CloseLog ( )

Close the log file.

Definition at line 80 of file MSGTool.cxx.

◆ CreateLog()

void MSGTool::CreateLog ( const TString &  name)

Create log file with given file name.

Parameters
namefile name of the log.

Definition at line 53 of file MSGTool.cxx.

◆ EndFocusRegion()

void MSGTool::EndFocusRegion ( const TString &  name)

End focus region.

Parameters
namename of the focus region.

Definition at line 103 of file MSGTool.cxx.

◆ EndTitle()

void MSGTool::EndTitle ( )

End the current title.

Definition at line 135 of file MSGTool.cxx.

◆ Level()

MSGLevel MSGTool::Level ( ) const

Get the current message level.

Definition at line 184 of file MSGTool.cxx.

◆ MSG()

template<typename... Args>
void NAGASH::MSGTool::MSG ( MSGLevel  level,
Args &&...  args 
)
inline

Output with given message level. Messages below the level in MSGTool will be ignored.

Definition at line 124 of file MSGTool.h.

◆ MSG_DEBUG()

template<typename... Args>
void NAGASH::MSGTool::MSG_DEBUG ( Args &&...  args)
inline

Output with DEBUG level. Messages below the level in MSGTool will be ignored.

Definition at line 160 of file MSGTool.h.

◆ MSG_ERROR()

template<typename... Args>
void NAGASH::MSGTool::MSG_ERROR ( Args &&...  args)
inline

Output with ERROR level. Messages below the level in MSGTool will be ignored.

Definition at line 139 of file MSGTool.h.

◆ MSG_INFO()

template<typename... Args>
void NAGASH::MSGTool::MSG_INFO ( Args &&...  args)
inline

Output with INFO level. Messages below the level in MSGTool will be ignored.

Definition at line 153 of file MSGTool.h.

◆ MSG_WARNING()

template<typename... Args>
void NAGASH::MSGTool::MSG_WARNING ( Args &&...  args)
inline

Output with WARNING level. Messages below the level in MSGTool will be ignored.

Definition at line 146 of file MSGTool.h.

◆ OpenLog()

void MSGTool::OpenLog ( const TString &  name)

Open log file with given file name.

Parameters
namefile name of the log.

Definition at line 67 of file MSGTool.cxx.

◆ operator=() [1/2]

MSGTool & NAGASH::MSGTool::operator= ( const MSGTool msg)
delete

◆ operator=() [2/2]

MSGTool & NAGASH::MSGTool::operator= ( MSGTool &&  msg)
delete

◆ Print()

template<typename... Args>
void NAGASH::MSGTool::Print ( Args &&...  args)
inlineprivate

Definition at line 166 of file MSGTool.h.

◆ PrintEnd()

void NAGASH::MSGTool::PrintEnd ( )
inlineprivate

Definition at line 179 of file MSGTool.h.

◆ PrintLevel()

void MSGTool::PrintLevel ( MSGLevel  level)
private

Definition at line 159 of file MSGTool.cxx.

◆ PrintSpace()

void NAGASH::MSGTool::PrintSpace ( )
inlineprivate

Definition at line 174 of file MSGTool.h.

◆ PrintTitle()

void MSGTool::PrintTitle ( )
private

Definition at line 142 of file MSGTool.cxx.

◆ SetOutputLevel()

MSGLevel MSGTool::SetOutputLevel ( MSGLevel  level)

Set the output message level.

Parameters
levelmessage level.
Returns
the given message level.

Definition at line 176 of file MSGTool.cxx.

◆ StartFocusRegion()

void MSGTool::StartFocusRegion ( const TString &  name)

Start focus region, inside this region the message level would be set to debug.

Parameters
namename of the focus region.

Definition at line 95 of file MSGTool.cxx.

◆ StartTitle()

void MSGTool::StartTitle ( const TString &  name)

Start a title with given name.

The output should be like

...->(title name)->(messages)
Parameters
nametitle name.

Definition at line 118 of file MSGTool.cxx.

◆ StartTitleWithGuard()

std::unique_ptr< MSGTool::MSGTitleGuard > MSGTool::StartTitleWithGuard ( const TString &  name)

Start a title with given name.

Parameters
namethe title name.
Returns
the pointer of MSGTitleGuard. Destruction of this pointer will end the title.

Definition at line 127 of file MSGTool.cxx.

Friends And Related Symbol Documentation

◆ Analysis

friend class Analysis
friend

Definition at line 35 of file MSGTool.h.

◆ ConfigTool

friend class ConfigTool
friend

Definition at line 34 of file MSGTool.h.

◆ LoopEvent

friend class LoopEvent
friend

Definition at line 30 of file MSGTool.h.

Member Data Documentation

◆ DefinedLevel

MSGLevel NAGASH::MSGTool::DefinedLevel = MSGLevel::INFO
private

Definition at line 38 of file MSGTool.h.

◆ FocusName

TString NAGASH::MSGTool::FocusName = "UNKNOWN"
private

Definition at line 39 of file MSGTool.h.

◆ FuncTitle

std::vector<TString> NAGASH::MSGTool::FuncTitle
private

Definition at line 40 of file MSGTool.h.

◆ isCreateLog

bool NAGASH::MSGTool::isCreateLog = false
private

Definition at line 43 of file MSGTool.h.

◆ isOpenLog

bool NAGASH::MSGTool::isOpenLog = false
private

Definition at line 44 of file MSGTool.h.

◆ LogFileName

TString NAGASH::MSGTool::LogFileName
private

Definition at line 45 of file MSGTool.h.

◆ MSGMutex

std::shared_mutex NAGASH::MSGTool::MSGMutex
mutableprivate

Definition at line 47 of file MSGTool.h.

◆ outfile

std::ofstream NAGASH::MSGTool::outfile
private

Definition at line 41 of file MSGTool.h.

◆ OutputLevel

MSGLevel NAGASH::MSGTool::OutputLevel = MSGLevel::INFO
private

Definition at line 37 of file MSGTool.h.

◆ tolog

bool NAGASH::MSGTool::tolog = false
private

Definition at line 42 of file MSGTool.h.


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