PandaRoot
Photospp::Log Class Reference

#include <Log.h>

Classes

struct  Pointer
 

Static Public Member Functions

static void Summary ()
 
static void SummaryAtExit ()
 
static void AddDecay (int type)
 
static ostream & Debug (unsigned short int code=0, bool count=true)
 
static ostream & Info (bool count=true)
 
static ostream & Warning (bool count=true)
 
static ostream & Error (bool count=true)
 
static void LogInfo (bool flag=true)
 
static void LogWarning (bool flag=true)
 
static void LogError (bool flag=true)
 
static void LogAll (bool flag=true)
 
static void LogPhlupa (int from, int to)
 
static void LogDebug (unsigned short s=0, unsigned short e=65535)
 
static void Assert (bool check, char *text=nullptr)
 
static void Fatal (string text, unsigned short int code=0)
 
static void Fatal (unsigned short int code=0)
 
static void RedirectOutput (void(*func)(), ostream &where= *out)
 
static void RedirectOutput (ostream &where= *out)
 
static void RevertOutput ()
 
static void IgnoreFailedAssert (bool flag=true)
 
static void IgnoreRedirection (bool flag=true)
 
static void IgnoreFatal (unsigned short s=0, unsigned short e=65535)
 
static void SetOutput (ostream *newOut)
 
static void SetOutput (ostream &newOut)
 
static void SetWarningLimit (int x)
 
static void Summary ()
 
static void SummaryAtExit ()
 
static void AddDecay (int type)
 
static ostream & Debug (unsigned short int code=0, bool count=true)
 
static ostream & Info (bool count=true)
 
static ostream & Warning (bool count=true)
 
static ostream & Error (bool count=true)
 
static void LogInfo (bool flag=true)
 
static void LogWarning (bool flag=true)
 
static void LogError (bool flag=true)
 
static void LogAll (bool flag=true)
 
static void LogPhlupa (int from, int to)
 
static void LogDebug (unsigned short s=0, unsigned short e=65535)
 
static void Assert (bool check, char *text=nullptr)
 
static void Fatal (string text, unsigned short int code=0)
 
static void Fatal (unsigned short int code=0)
 
static void RedirectOutput (void(*func)(), ostream &where= *out)
 
static void RedirectOutput (ostream &where= *out)
 
static void RevertOutput ()
 
static void IgnoreFailedAssert (bool flag=true)
 
static void IgnoreRedirection (bool flag=true)
 
static void IgnoreFatal (unsigned short s=0, unsigned short e=65535)
 
static void SetOutput (ostream *newOut)
 
static void SetOutput (ostream &newOut)
 
static void SetWarningLimit (int x)
 

Static Protected Attributes

static streambuf * bCout
 
static streambuf * bCerr
 
static ostream * out
 
static stringstream buf
 
static int warnLimit
 
static int decays [4]
 
static int dCount
 
static int dRangeS
 
static int dRangeE
 
static int faCount
 
static int faRangeS
 
static int faRangeE
 
static int iCount
 
static int wCount
 
static int eCount
 
static int asCount
 
static int asFailedCount
 
static bool iAction
 
static bool wAction
 
static bool eAction
 
static bool asAction
 
static bool rAction
 
static list< Pointer * > * PointerList
 

Detailed Description

Definition at line 32 of file Log.h.

Member Function Documentation

◆ AddDecay() [1/2]

static void Photospp::Log::AddDecay ( int  type)
static

Adds the decay to the counter. The type is: 0 - gun, 1 - no mothers & grandmothers, 2 - no mothers, 3 - ok.

Referenced by SummaryAtExit().

◆ AddDecay() [2/2]

static void Photospp::Log::AddDecay ( int  type)
static

Adds the decay to the counter. The type is: 0 - gun, 1 - no mothers & grandmothers, 2 - no mothers, 3 - ok.

◆ Assert() [1/2]

static void Photospp::Log::Assert ( bool  check,
char *  text = nullptr 
)
static

Asserts logical value. If the assertion fails, the default message or 'text' will be printed and the program will terminate. Program termination can be suppressed by Log::IgnoreFailedAsserts();

◆ Assert() [2/2]

static void Photospp::Log::Assert ( bool  check,
char *  text = nullptr 
)
static

Asserts logical value. If the assertion fails, the default message or 'text' will be printed and the program will terminate. Program termination can be suppressed by Log::IgnoreFailedAsserts();

Referenced by LogDebug().

◆ Debug() [1/2]

static ostream& Photospp::Log::Debug ( unsigned short int  code = 0,
bool  count = true 
)
static

Four logging entries. Usage: Log::Info()<<"Logging some info: "<<8<<" > "<<7.9<<endl; Use Log::Info(false) if You don't want the message to be counted.

Referenced by SummaryAtExit().

◆ Debug() [2/2]

static ostream& Photospp::Log::Debug ( unsigned short int  code = 0,
bool  count = true 
)
static

Four logging entries. Usage: Log::Info()<<"Logging some info: "<<8<<" > "<<7.9<<endl; Use Log::Info(false) if You don't want the message to be counted.

◆ Error() [1/2]

static ostream& Photospp::Log::Error ( bool  count = true)
static

◆ Error() [2/2]

static ostream& Photospp::Log::Error ( bool  count = true)
static

Referenced by SummaryAtExit().

◆ Fatal() [1/4]

static void Photospp::Log::Fatal ( string  text,
unsigned short int  code = 0 
)
static

Terminates the program with added default message or 'text'. It can be suppressed by Log::IgnoreFatal();

◆ Fatal() [2/4]

static void Photospp::Log::Fatal ( string  text,
unsigned short int  code = 0 
)
static

Terminates the program with added default message or 'text'. It can be suppressed by Log::IgnoreFatal();

Referenced by LogDebug().

◆ Fatal() [3/4]

static void Photospp::Log::Fatal ( unsigned short int  code = 0)
inlinestatic

Definition at line 88 of file Log.h.

References Fatal(), out, and RedirectOutput().

Referenced by Fatal().

88 { Fatal(nullptr, code); }
static void Fatal(string text, unsigned short int code=0)

◆ Fatal() [4/4]

static void Photospp::Log::Fatal ( unsigned short int  code = 0)
inlinestatic

Definition at line 88 of file 3.52/src/utilities/Log.h.

References Fatal(), out, and RedirectOutput().

Referenced by Fatal().

88 { Fatal(nullptr, code); }
static void Fatal(string text, unsigned short int code=0)

◆ IgnoreFailedAssert() [1/2]

static void Photospp::Log::IgnoreFailedAssert ( bool  flag = true)
inlinestatic

Do not exit when Log::Assert() check is false. The number of failed asserts will be listed in the summary.

Definition at line 109 of file Log.h.

References asAction.

109 { asAction = !flag; }
static bool asAction
Definition: Log.h:140

◆ IgnoreFailedAssert() [2/2]

static void Photospp::Log::IgnoreFailedAssert ( bool  flag = true)
inlinestatic

Do not exit when Log::Assert() check is false. The number of failed asserts will be listed in the summary.

Definition at line 109 of file 3.52/src/utilities/Log.h.

References asAction.

109 { asAction = !flag; }
static bool asAction
Definition: Log.h:140

◆ IgnoreFatal() [1/2]

static void Photospp::Log::IgnoreFatal ( unsigned short  s = 0,
unsigned short  e = 65535 
)
inlinestatic

Do not exit when Log::Fatal() with the code within the provided range is called. The number of ignored fatal errors will be listed in the summary.

Definition at line 117 of file Log.h.

References faRangeE, and faRangeS.

118  {
119  faRangeS = s;
120  faRangeE = e;
121  }
static int faRangeS
Definition: Log.h:138
static int faRangeE
Definition: Log.h:138

◆ IgnoreFatal() [2/2]

static void Photospp::Log::IgnoreFatal ( unsigned short  s = 0,
unsigned short  e = 65535 
)
inlinestatic

Do not exit when Log::Fatal() with the code within the provided range is called. The number of ignored fatal errors will be listed in the summary.

Definition at line 117 of file 3.52/src/utilities/Log.h.

References faRangeE, and faRangeS.

118  {
119  faRangeS = s;
120  faRangeE = e;
121  }
static int faRangeS
Definition: Log.h:138
static int faRangeE
Definition: Log.h:138

◆ IgnoreRedirection() [1/2]

static void Photospp::Log::IgnoreRedirection ( bool  flag = true)
inlinestatic

Ignores redirections of functions' output. The function will still be called in a normal way.

Definition at line 113 of file 3.52/src/utilities/Log.h.

References rAction.

113 { rAction = !flag; }
static bool rAction
Definition: Log.h:140

◆ IgnoreRedirection() [2/2]

static void Photospp::Log::IgnoreRedirection ( bool  flag = true)
inlinestatic

Ignores redirections of functions' output. The function will still be called in a normal way.

Definition at line 113 of file Log.h.

References rAction.

113 { rAction = !flag; }
static bool rAction
Definition: Log.h:140

◆ Info() [1/2]

static ostream& Photospp::Log::Info ( bool  count = true)
static

Referenced by SummaryAtExit().

◆ Info() [2/2]

static ostream& Photospp::Log::Info ( bool  count = true)
static

◆ LogAll() [1/2]

static void Photospp::Log::LogAll ( bool  flag = true)
inlinestatic

Definition at line 58 of file 3.52/src/utilities/Log.h.

References dRangeE, dRangeS, eAction, iAction, and wAction.

59  {
60  iAction = wAction = eAction = flag;
61  dRangeS = 0;
62  dRangeE = 65535;
63  }
static int dRangeE
Definition: Log.h:138
static bool wAction
Definition: Log.h:140
static bool iAction
Definition: Log.h:140
static int dRangeS
Definition: Log.h:138
static bool eAction
Definition: Log.h:140

◆ LogAll() [2/2]

static void Photospp::Log::LogAll ( bool  flag = true)
inlinestatic

Definition at line 58 of file Log.h.

References dRangeE, dRangeS, eAction, iAction, and wAction.

59  {
60  iAction = wAction = eAction = flag;
61  dRangeS = 0;
62  dRangeE = 65535;
63  }
static int dRangeE
Definition: Log.h:138
static bool wAction
Definition: Log.h:140
static bool iAction
Definition: Log.h:140
static int dRangeS
Definition: Log.h:138
static bool eAction
Definition: Log.h:140

◆ LogDebug() [1/2]

static void Photospp::Log::LogDebug ( unsigned short  s = 0,
unsigned short  e = 65535 
)
inlinestatic

Sets the range of debug codes that will be printed. By default, the debug messages are turned off.

Definition at line 74 of file 3.52/src/utilities/Log.h.

References Assert(), dRangeE, dRangeS, and Fatal().

75  {
76  dRangeS = s;
77  dRangeE = e;
78  }
static int dRangeE
Definition: Log.h:138
static int dRangeS
Definition: Log.h:138

◆ LogDebug() [2/2]

static void Photospp::Log::LogDebug ( unsigned short  s = 0,
unsigned short  e = 65535 
)
inlinestatic

Sets the range of debug codes that will be printed. By default, the debug messages are turned off.

Definition at line 74 of file Log.h.

References Assert(), dRangeE, dRangeS, and Fatal().

75  {
76  dRangeS = s;
77  dRangeE = e;
78  }
static int dRangeE
Definition: Log.h:138
static int dRangeS
Definition: Log.h:138

◆ LogError() [1/2]

static void Photospp::Log::LogError ( bool  flag = true)
inlinestatic

Definition at line 56 of file 3.52/src/utilities/Log.h.

References eAction.

56 { eAction = flag; }
static bool eAction
Definition: Log.h:140

◆ LogError() [2/2]

static void Photospp::Log::LogError ( bool  flag = true)
inlinestatic

Definition at line 56 of file Log.h.

References eAction.

56 { eAction = flag; }
static bool eAction
Definition: Log.h:140

◆ LogInfo() [1/2]

static void Photospp::Log::LogInfo ( bool  flag = true)
inlinestatic

Turns off or on particular types of messages By default, only debugging messages are turned off.

Definition at line 54 of file Log.h.

References iAction.

54 { iAction = flag; }
static bool iAction
Definition: Log.h:140

◆ LogInfo() [2/2]

static void Photospp::Log::LogInfo ( bool  flag = true)
inlinestatic

Turns off or on particular types of messages By default, only debugging messages are turned off.

Definition at line 54 of file 3.52/src/utilities/Log.h.

References iAction.

54 { iAction = flag; }
static bool iAction
Definition: Log.h:140

◆ LogPhlupa() [1/2]

static void Photospp::Log::LogPhlupa ( int  from,
int  to 
)
inlinestatic

Definition at line 66 of file 3.52/src/utilities/Log.h.

References phlupy_.

67  {
68  phlupy_.ipoinm = from;
69  phlupy_.ipoin = to;
70  }
struct @23 phlupy_

◆ LogPhlupa() [2/2]

static void Photospp::Log::LogPhlupa ( int  from,
int  to 
)
inlinestatic

Definition at line 66 of file Log.h.

References phlupy_.

67  {
68  phlupy_.ipoinm = from;
69  phlupy_.ipoin = to;
70  }
struct @23 phlupy_

◆ LogWarning() [1/2]

static void Photospp::Log::LogWarning ( bool  flag = true)
inlinestatic

Definition at line 55 of file 3.52/src/utilities/Log.h.

References wAction.

55 { wAction = flag; }
static bool wAction
Definition: Log.h:140

◆ LogWarning() [2/2]

static void Photospp::Log::LogWarning ( bool  flag = true)
inlinestatic

Definition at line 55 of file Log.h.

References wAction.

55 { wAction = flag; }
static bool wAction
Definition: Log.h:140

◆ RedirectOutput() [1/4]

static void Photospp::Log::RedirectOutput ( void(*)()  func,
ostream &  where = *out 
)
static

Redirects output to log. Redirection can be done for a block of code or for one function only. Redirection can be turned off by using Log::IgnoreRedirection(); If the target is one of the log streams (for example): Log::RedirectOutput( someFunction, Log::Info() ); You can turn the function's messages off by turning the apropriate log entries off. The redirected code will still be executed, only messages are redirected.

Referenced by Fatal().

◆ RedirectOutput() [2/4]

static void Photospp::Log::RedirectOutput ( void(*)()  func,
ostream &  where = *out 
)
static

Redirects output to log. Redirection can be done for a block of code or for one function only. Redirection can be turned off by using Log::IgnoreRedirection(); If the target is one of the log streams (for example): Log::RedirectOutput( someFunction, Log::Info() ); You can turn the function's messages off by turning the apropriate log entries off. The redirected code will still be executed, only messages are redirected.

◆ RedirectOutput() [3/4]

static void Photospp::Log::RedirectOutput ( ostream &  where = *out)
static

◆ RedirectOutput() [4/4]

static void Photospp::Log::RedirectOutput ( ostream &  where = *out)
static

◆ RevertOutput() [1/2]

static void Photospp::Log::RevertOutput ( )
inlinestatic

WARNING! If You're redirecting more than one function, do not forget to use RevertOutput() afterwards.

Definition at line 101 of file Log.h.

References bCerr, and bCout.

102  {
103  std::cout.rdbuf(bCout);
104  std::cerr.rdbuf(bCerr);
105  }
static streambuf * bCout
Definition: Log.h:133
static streambuf * bCerr
Definition: Log.h:133

◆ RevertOutput() [2/2]

static void Photospp::Log::RevertOutput ( )
inlinestatic

WARNING! If You're redirecting more than one function, do not forget to use RevertOutput() afterwards.

Definition at line 101 of file 3.52/src/utilities/Log.h.

References bCerr, and bCout.

102  {
103  std::cout.rdbuf(bCout);
104  std::cerr.rdbuf(bCerr);
105  }
static streambuf * bCout
Definition: Log.h:133
static streambuf * bCerr
Definition: Log.h:133

◆ SetOutput() [1/4]

static void Photospp::Log::SetOutput ( ostream *  newOut)
inlinestatic

Change the output of the logged messages. Log::SetOutput(cerr); //changes the output to cerr Log::SetOutput(new ofstream("log.txt")); //changes the output to a file "log.txt"

Definition at line 126 of file Log.h.

References out.

126 { out = newOut; }
static ostream * out
Definition: Log.h:134

◆ SetOutput() [2/4]

static void Photospp::Log::SetOutput ( ostream *  newOut)
inlinestatic

Change the output of the logged messages. Log::SetOutput(cerr); //changes the output to cerr Log::SetOutput(new ofstream("log.txt")); //changes the output to a file "log.txt"

Definition at line 126 of file 3.52/src/utilities/Log.h.

References out.

126 { out = newOut; }
static ostream * out
Definition: Log.h:134

◆ SetOutput() [3/4]

static void Photospp::Log::SetOutput ( ostream &  newOut)
inlinestatic

Definition at line 127 of file 3.52/src/utilities/Log.h.

References out.

127 { out = &newOut; }
static ostream * out
Definition: Log.h:134

◆ SetOutput() [4/4]

static void Photospp::Log::SetOutput ( ostream &  newOut)
inlinestatic

Definition at line 127 of file Log.h.

References out.

127 { out = &newOut; }
static ostream * out
Definition: Log.h:134

◆ SetWarningLimit() [1/2]

static void Photospp::Log::SetWarningLimit ( int  x)
inlinestatic

Change the limit of warnings that will be displayed. Set to 0 for no limit.

Definition at line 130 of file Log.h.

References warnLimit.

130 { warnLimit = x; }
static int warnLimit
Definition: Log.h:136

◆ SetWarningLimit() [2/2]

static void Photospp::Log::SetWarningLimit ( int  x)
inlinestatic

◆ Summary() [1/2]

static void Photospp::Log::Summary ( )
static

Shows the summary of all messages.

◆ Summary() [2/2]

static void Photospp::Log::Summary ( )
static

Shows the summary of all messages.

Referenced by SummaryAtExit().

◆ SummaryAtExit() [1/2]

static void Photospp::Log::SummaryAtExit ( )
inlinestatic

Shows the summary at the end of the program.

Definition at line 38 of file 3.52/src/utilities/Log.h.

References AddDecay(), Debug(), Error(), Info(), Summary(), and Warning().

38 { atexit(Summary); }
static void Summary()

◆ SummaryAtExit() [2/2]

static void Photospp::Log::SummaryAtExit ( )
inlinestatic

Shows the summary at the end of the program.

Definition at line 38 of file Log.h.

References AddDecay(), Debug(), Error(), Info(), and Warning().

38 { atexit(Summary); }
static void Summary()

◆ Warning() [1/2]

static ostream& Photospp::Log::Warning ( bool  count = true)
static

◆ Warning() [2/2]

static ostream& Photospp::Log::Warning ( bool  count = true)
static

Referenced by SummaryAtExit().

Member Data Documentation

◆ asAction

static bool Photospp::Log::asAction
staticprotected

Definition at line 140 of file Log.h.

Referenced by IgnoreFailedAssert(), and SetWarningLimit().

◆ asCount

static int Photospp::Log::asCount
staticprotected

Definition at line 139 of file Log.h.

Referenced by SetWarningLimit().

◆ asFailedCount

static int Photospp::Log::asFailedCount
staticprotected

Definition at line 139 of file Log.h.

Referenced by SetWarningLimit().

◆ bCerr

static streambuf * Photospp::Log::bCerr
staticprotected

Definition at line 133 of file Log.h.

Referenced by RevertOutput(), and SetWarningLimit().

◆ bCout

static streambuf * Photospp::Log::bCout
staticprotected

Definition at line 133 of file Log.h.

Referenced by RevertOutput(), and SetWarningLimit().

◆ buf

static stringstream Photospp::Log::buf
staticprotected

Definition at line 135 of file Log.h.

Referenced by SetWarningLimit().

◆ dCount

static int Photospp::Log::dCount
staticprotected

Definition at line 138 of file Log.h.

Referenced by SetWarningLimit().

◆ decays

static int Photospp::Log::decays
staticprotected

Definition at line 137 of file Log.h.

Referenced by SetWarningLimit().

◆ dRangeE

static int Photospp::Log::dRangeE
staticprotected

Definition at line 138 of file Log.h.

Referenced by LogAll(), LogDebug(), and SetWarningLimit().

◆ dRangeS

static int Photospp::Log::dRangeS
staticprotected

Definition at line 138 of file Log.h.

Referenced by LogAll(), LogDebug(), and SetWarningLimit().

◆ eAction

static bool Photospp::Log::eAction
staticprotected

Definition at line 140 of file Log.h.

Referenced by LogAll(), LogError(), and SetWarningLimit().

◆ eCount

static int Photospp::Log::eCount
staticprotected

Definition at line 139 of file Log.h.

Referenced by SetWarningLimit().

◆ faCount

static int Photospp::Log::faCount
staticprotected

Definition at line 138 of file Log.h.

Referenced by SetWarningLimit().

◆ faRangeE

static int Photospp::Log::faRangeE
staticprotected

Definition at line 138 of file Log.h.

Referenced by IgnoreFatal(), and SetWarningLimit().

◆ faRangeS

static int Photospp::Log::faRangeS
staticprotected

Definition at line 138 of file Log.h.

Referenced by IgnoreFatal(), and SetWarningLimit().

◆ iAction

static bool Photospp::Log::iAction
staticprotected

Definition at line 140 of file Log.h.

Referenced by LogAll(), LogInfo(), and SetWarningLimit().

◆ iCount

static int Photospp::Log::iCount
staticprotected

Definition at line 139 of file Log.h.

Referenced by SetWarningLimit().

◆ out

static ostream * Photospp::Log::out
staticprotected

Definition at line 134 of file Log.h.

Referenced by Fatal(), SetOutput(), and SetWarningLimit().

◆ PointerList

static list< Pointer * > * Photospp::Log::PointerList
staticprotected

Definition at line 152 of file Log.h.

Referenced by SetWarningLimit().

◆ rAction

static bool Photospp::Log::rAction
staticprotected

Definition at line 140 of file Log.h.

Referenced by IgnoreRedirection(), and SetWarningLimit().

◆ wAction

static bool Photospp::Log::wAction
staticprotected

Definition at line 140 of file Log.h.

Referenced by LogAll(), LogWarning(), and SetWarningLimit().

◆ warnLimit

static int Photospp::Log::warnLimit
staticprotected

Definition at line 136 of file Log.h.

Referenced by SetWarningLimit().

◆ wCount

static int Photospp::Log::wCount
staticprotected

Definition at line 139 of file Log.h.

Referenced by SetWarningLimit().


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