MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.basecode.Log Class Reference

The Log class provides general output in text form. More...

Public Member Functions

 Log (string strSrc)
 The Log constructor. More...
 
void WriteLine (string str, bool bOverrideEnabled=false, bool bHeader=false, bool bError=false, bool bDisable=false)
 Write a line of output. More...
 
void WriteHeader (string str)
 Write a header as output. More...
 
void WriteError (Exception e)
 Write an error as output. More...
 
void EXPECT_EQUAL< T > (double df1, double df2, string str=null)
 Test whether two values are equal using a given type 'T'. More...
 
void EXPECT_NEAR_FLOAT (double df1, double df2, double dfErr, string str="")
 Test whether two numbers are within a range (dfErr) of one another using the float resolution. More...
 
void EXPECT_NEAR (double df1, double df2, double dfErr, string str="")
 Test whether two numbers are within a range (dfErr) of one another using the double resolution. More...
 
void CHECK (bool b, string str)
 Test a flag for true. More...
 
void CHECK_EQ (double df1, double df2, string str)
 Test whether one number is equal to another. More...
 
void CHECK_NE (double df1, double df2, string str)
 Test whether one number is not-equal to another. More...
 
void CHECK_LE (double df1, double df2, string str)
 Test whether one number is less than or equal to another. More...
 
void CHECK_LT (double df1, double df2, string str)
 Test whether one number is less than another. More...
 
void CHECK_GE (double df1, double df2, string str)
 Test whether one number is greater than or equal to another. More...
 
void CHECK_GT (double df1, double df2, string str)
 Test whether one number is greater than another. More...
 
void CHECK_EQ (float f1, float f2, string str)
 Test whether one number is equal to another. More...
 
void CHECK_NE (float f1, float f2, string str)
 Test whether one number is not equal to another. More...
 
void CHECK_LE (float f1, float f2, string str)
 Test whether one number is less-than or equal to another. More...
 
void CHECK_LT (float f1, float f2, string str)
 Test whether one number is less-than another. More...
 
void CHECK_GE (float f1, float f2, string str)
 Test whether one number is greater-than or equal to another. More...
 
void CHECK_GT (float f1, float f2, string str)
 Test whether one number is greater-than another. More...
 
void CHECK_BOUNDS (float f1, float fmin, float fmax, string str)
 Test whether a number falls within a set bound or not. More...
 
void FAIL (string str)
 Causes a failure which throws an exception with the desciptive text. More...
 

Properties

bool Enable [set]
 Enables/disables the Log. When disabled, the Log does not output any data. More...
 
bool IsEnabled [get]
 Returns whether or not the Log is enabled. More...
 
string PreText [getset]
 Get/set the pre-text prepended to each output line when set. More...
 
bool EnableTrace [getset]
 Enables/disables the Trace. When enabled, the .Net Trace.WriteLine is called in addition to the normal Log output. This is primarily used when debugging. More...
 
double Progress [getset]
 Get/set the progress associated with the Log. More...
 

Events

EventHandler< LogArgOnWriteLine
 The OnWriteLine event fires each time the WriteLine, WriteHeader or WriteError functions are called. More...
 
EventHandler< LogProgressArgOnProgress
 The OnProgress event fires each time the Progress value is set. More...
 

Detailed Description

The Log class provides general output in text form.

Definition at line 12 of file Log.cs.

Constructor & Destructor Documentation

◆ Log()

MyCaffe.basecode.Log.Log ( string  strSrc)

The Log constructor.

Parameters
strSrcSpecifies the source of the Log.

Definition at line 33 of file Log.cs.

Member Function Documentation

◆ CHECK()

void MyCaffe.basecode.Log.CHECK ( bool  b,
string  str 
)

Test a flag for true.

Parameters
bSpecifies the flag to test.
strSpecifies the description text to output if the flag is false.

Definition at line 227 of file Log.cs.

◆ CHECK_BOUNDS()

void MyCaffe.basecode.Log.CHECK_BOUNDS ( float  f1,
float  fmin,
float  fmax,
string  str 
)

Test whether a number falls within a set bound or not.

Parameters
f1Specifies the number to test.
fminSpecifies the lower bound.
fmaxSpecifies the upper bound.
strSpecifies the message to output on failure.

Definition at line 384 of file Log.cs.

◆ CHECK_EQ() [1/2]

void MyCaffe.basecode.Log.CHECK_EQ ( double  df1,
double  df2,
string  str 
)

Test whether one number is equal to another.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 239 of file Log.cs.

◆ CHECK_EQ() [2/2]

void MyCaffe.basecode.Log.CHECK_EQ ( float  f1,
float  f2,
string  str 
)

Test whether one number is equal to another.

Parameters
f1Specifies the first value to test.
f2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 311 of file Log.cs.

◆ CHECK_GE() [1/2]

void MyCaffe.basecode.Log.CHECK_GE ( double  df1,
double  df2,
string  str 
)

Test whether one number is greater than or equal to another.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 287 of file Log.cs.

◆ CHECK_GE() [2/2]

void MyCaffe.basecode.Log.CHECK_GE ( float  f1,
float  f2,
string  str 
)

Test whether one number is greater-than or equal to another.

Parameters
f1Specifies the first value to test.
f2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 359 of file Log.cs.

◆ CHECK_GT() [1/2]

void MyCaffe.basecode.Log.CHECK_GT ( double  df1,
double  df2,
string  str 
)

Test whether one number is greater than another.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 299 of file Log.cs.

◆ CHECK_GT() [2/2]

void MyCaffe.basecode.Log.CHECK_GT ( float  f1,
float  f2,
string  str 
)

Test whether one number is greater-than another.

Parameters
f1Specifies the first value to test.
f2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 371 of file Log.cs.

◆ CHECK_LE() [1/2]

void MyCaffe.basecode.Log.CHECK_LE ( double  df1,
double  df2,
string  str 
)

Test whether one number is less than or equal to another.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 263 of file Log.cs.

◆ CHECK_LE() [2/2]

void MyCaffe.basecode.Log.CHECK_LE ( float  f1,
float  f2,
string  str 
)

Test whether one number is less-than or equal to another.

Parameters
f1Specifies the first value to test.
f2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 335 of file Log.cs.

◆ CHECK_LT() [1/2]

void MyCaffe.basecode.Log.CHECK_LT ( double  df1,
double  df2,
string  str 
)

Test whether one number is less than another.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 275 of file Log.cs.

◆ CHECK_LT() [2/2]

void MyCaffe.basecode.Log.CHECK_LT ( float  f1,
float  f2,
string  str 
)

Test whether one number is less-than another.

Parameters
f1Specifies the first value to test.
f2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 347 of file Log.cs.

◆ CHECK_NE() [1/2]

void MyCaffe.basecode.Log.CHECK_NE ( double  df1,
double  df2,
string  str 
)

Test whether one number is not-equal to another.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 251 of file Log.cs.

◆ CHECK_NE() [2/2]

void MyCaffe.basecode.Log.CHECK_NE ( float  f1,
float  f2,
string  str 
)

Test whether one number is not equal to another.

Parameters
f1Specifies the first value to test.
f2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 323 of file Log.cs.

◆ EXPECT_EQUAL< T >()

void MyCaffe.basecode.Log.EXPECT_EQUAL< T > ( double  df1,
double  df2,
string  str = null 
)

Test whether two values are equal using a given type 'T'.

Template Parameters
TSpecifies the resolution for the test: either double or float.
Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 168 of file Log.cs.

◆ EXPECT_NEAR()

void MyCaffe.basecode.Log.EXPECT_NEAR ( double  df1,
double  df2,
double  dfErr,
string  str = "" 
)

Test whether two numbers are within a range (dfErr) of one another using the double resolution.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
dfErrSpecifies the acceptable error for the test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 214 of file Log.cs.

◆ EXPECT_NEAR_FLOAT()

void MyCaffe.basecode.Log.EXPECT_NEAR_FLOAT ( double  df1,
double  df2,
double  dfErr,
string  str = "" 
)

Test whether two numbers are within a range (dfErr) of one another using the float resolution.

Parameters
df1Specifies the first value to test.
df2Specifies the second value to test.
dfErrSpecifies the acceptable error for the test.
strSpecifies the descriptive text to output if the test fails.

Definition at line 196 of file Log.cs.

◆ FAIL()

void MyCaffe.basecode.Log.FAIL ( string  str)

Causes a failure which throws an exception with the desciptive text.

Parameters
strSpecifies the descriptive text to output.

Definition at line 394 of file Log.cs.

◆ WriteError()

void MyCaffe.basecode.Log.WriteError ( Exception  e)

Write an error as output.

Parameters
eSpecifies the error.

Definition at line 130 of file Log.cs.

◆ WriteHeader()

void MyCaffe.basecode.Log.WriteHeader ( string  str)

Write a header as output.

Parameters
strSpecifies the header text.

Definition at line 109 of file Log.cs.

◆ WriteLine()

void MyCaffe.basecode.Log.WriteLine ( string  str,
bool  bOverrideEnabled = false,
bool  bHeader = false,
bool  bError = false,
bool  bDisable = false 
)

Write a line of output.

Parameters
strSpecifies the string to output.
bOverrideEnabledSpecifies whether or not to override the enabled state (default = false).
bHeaderSpecifies whether or not the output text represents a header (default = false).
bErrorSpecfifies whether or not the output text represents an error (default = false).
bDisableSpecifies whether or not to disable the output of this line (e.g. used internally).

Definition at line 80 of file Log.cs.

Property Documentation

◆ Enable

bool MyCaffe.basecode.Log.Enable
set

Enables/disables the Log. When disabled, the Log does not output any data.

Definition at line 41 of file Log.cs.

◆ EnableTrace

bool MyCaffe.basecode.Log.EnableTrace
getset

Enables/disables the Trace. When enabled, the .Net Trace.WriteLine is called in addition to the normal Log output. This is primarily used when debugging.

Definition at line 66 of file Log.cs.

◆ IsEnabled

bool MyCaffe.basecode.Log.IsEnabled
get

Returns whether or not the Log is enabled.

Definition at line 49 of file Log.cs.

◆ PreText

string MyCaffe.basecode.Log.PreText
getset

Get/set the pre-text prepended to each output line when set.

Definition at line 57 of file Log.cs.

◆ Progress

double MyCaffe.basecode.Log.Progress
getset

Get/set the progress associated with the Log.

Definition at line 146 of file Log.cs.

Event Documentation

◆ OnProgress

EventHandler<LogProgressArg> MyCaffe.basecode.Log.OnProgress

The OnProgress event fires each time the Progress value is set.

Definition at line 27 of file Log.cs.

◆ OnWriteLine

EventHandler<LogArg> MyCaffe.basecode.Log.OnWriteLine

The OnWriteLine event fires each time the WriteLine, WriteHeader or WriteError functions are called.

Definition at line 23 of file Log.cs.


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