ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Inner Classes | Public Static Fields | Public Fields | Public Methods | Protected Fields | List of all members
ScopeInfo Class Reference
Collaboration diagram for ScopeInfo:
[legend]

Class Description


Encapsulates information of the caller that can be collected. This is platform specific, in this case, .NET 4.5. What we currently can get from the .NET compiler, is the source file name of the calling code, the line number within the source file name and the name of the method the call is placed. We do not get the class name of the object or even its instance.

Inner Classes

class  Scope
 
class  SourceFile
 
class  SourcePathTrimRule
 

Public Static Fields

static int DefaultCacheSize = 5
 
static List< SourcePathTrimRuleGlobalSPTRs = new List<SourcePathTrimRule>()
 
static bool GlobalSPTRsReadFromConfig = false
 

Public Fields

List< SourcePathTrimRuleLocalSPTRs = new List<SourcePathTrimRule>()
 
Dictionary< int, String > threadDictionary =new Dictionary<int, String>()
 

Public Methods

 ScopeInfo (String name)
 
AString GetFileName ()
 
AString GetFileNameWithoutExtension ()
 
String GetFullPath (out int length)
 
int GetLineNumber ()
 
String GetLoxName ()
 
String GetMethod ()
 
String GetOrigFile ()
 
Thread GetThread ()
 
int GetThreadID ()
 
AString GetThreadName ()
 
Ticks GetTimeStamp ()
 
AString GetTrimmedPath ()
 
void Release ()
 
void Set (int callerLineNumber, String callerSourceFileName, String callerMemberName, Thread thread)
 
void SetSourcePathTrimRule (String path, Inclusion includeString, int trimOffset, Case sensitivity, String trimReplacement, Reach reach, int priority)
 

Protected Fields

int actScopeDepth = -1
 
bool AutoDetectTrimableSourcePath = true
 
SourceFile[] cache
 
long cacheRun = 0
 
int cacheSize
 
SourceFile lastSourceFile
 
String loxName
 
List< Scopescopes = new List<Scope>()
 
Thread thread
 
int threadID
 
AString threadName = new AString(32)
 

Constructor & Destructor Documentation

◆ ScopeInfo()

ScopeInfo ( String  name)
inline

Constructs a scope info.

Parameters
nameThe name of the Lox we belong to. Will be converted to upper case.

Member Function Documentation

◆ GetFileName()

AString GetFileName ( )
inline

Receives the source file name excluding the path (usually provided by System.Runtime.CompilerServices).

Returns
The source file name excluding the path

◆ GetFileNameWithoutExtension()

AString GetFileNameWithoutExtension ( )
inline

Receives the source file name excluding the path and without an extension (usually provided by System.Runtime.CompilerServices).

Returns
The source file name excluding the path and extension.

◆ GetFullPath()

String GetFullPath ( out int  length)
inline

Returns the original path and filename of the source file, togehter with length, of the path within this string (as output parameter) .

Parameters
[out]lengthOutput parameter returning the length of the path string.
Returns
Gets the path of the source file (not trimmed, see GetTrimmedPath).

◆ GetLineNumber()

int GetLineNumber ( )
inline

Receives the source file line number (usually provided by System.Runtime.CompilerServices).

Returns
The source file line number.

◆ GetLoxName()

String GetLoxName ( )
inline

Receives the name of the Lox we are belonging to (this is a 1:1 relationship).

Returns
The name of the Lox.

◆ GetMethod()

String GetMethod ( )
inline

Receives the method name (usually provided by System.Runtime.CompilerServices).

Returns
The method name.

◆ GetOrigFile()

String GetOrigFile ( )
inline

Receives the original filename and path of the source file (usually provided by ).

Returns
The full path and filename of the source file.

◆ GetThread()

Thread GetThread ( )
inline

Receives the thread of the caller.

Returns
The thread ID.

◆ GetThreadID()

int GetThreadID ( )
inline

Receives the thread ID of the caller.

Returns
The thread ID.

◆ GetThreadName()

AString GetThreadName ( )
inline

Receives the translated name or, if not translated, "name(ID)" of the caller.

Returns
The thread ID.

◆ GetTimeStamp()

Ticks GetTimeStamp ( )
inline

The timestamp of the last invocation of Set.

Returns
The latest timestamp.

◆ GetTrimmedPath()

AString GetTrimmedPath ( )
inline

Tries to trim the source files' path. Sets variable SourceFile.trimmedPath to either the successfully trimmed path or to the non-trimmed one. This way, it is executed only once, at it is 'lazily' invoked by GetTrimmedPath()

Returns
The path of the source file, trimmed according to trim-information provided with SetSourcePathTrimRule or detected according to AutoDetectTrimableSourcePath.

◆ Release()

void Release ( )
inline

Releases latest scope information.

◆ Set()

void Set ( int  callerLineNumber,
String  callerSourceFileName,
String  callerMemberName,
Thread  thread 
)
inline

Stores caller parameters, sets actual time stamp and receives thread information

Parameters
callerLineNumberLine number within the source code file the log call is placed in.
callerSourceFileNameName and path of the source code file the log call is placed in.
callerMemberNameName of the method the log call is placed in.
threadThe thread. If null, it will be determined if needed.

◆ SetSourcePathTrimRule()

void SetSourcePathTrimRule ( String  path,
Inclusion  includeString,
int  trimOffset,
Case  sensitivity,
String  trimReplacement,
Reach  reach,
int  priority 
)
inline

Does the job for Lox.SetSourcePathTrimRule and Lox.ClearSourcePathTrimRules.

Parameters
pathThe path to search for. If not starting with '*', a prefix is searched.
includeStringDetermines if path should be included in the trimmed path or not.
trimOffsetAdjusts the portion of path that is trimmed. 999999 to clear!
sensitivityDetermines if the comparison of path with a source files' path is performed case sensitive or not.
trimReplacementReplacement string for trimmed portion of the path.
reachDenotes whether the rule is applied locally (to this Lox only) or applies to all instances of class Lox.
priorityThe priority of the setting.

Member Data Documentation

◆ actScopeDepth

int actScopeDepth = -1
protected

The current depth of recursive invocations.

◆ AutoDetectTrimableSourcePath

bool AutoDetectTrimableSourcePath = true
protected

If true, next time a source path can not be trimmed successfully with custom trim information provided with Lox.SetSourcePathTrimRule some trim information is automatically created by comparing such source files' path with the path of the executable of the current process.

◆ cache

SourceFile [] cache
protected

A list of source files. The its size is dependent on static field DefaultCacheSize.

◆ cacheRun

long cacheRun = 0
protected

The 'timestamp' used to identify the LRU entry. Incremented, whenever a different source file is evaluated.

◆ cacheSize

int cacheSize
protected

The number of source file path and corresponding, evaluated derived values. Determined in the constructor by reading static field DefaultCacheSize.

◆ DefaultCacheSize

int DefaultCacheSize = 5
static

The number of source file path and corresponding, evaluated derived values. This might be modified, prior to creating any object of class Lox.
Defaults to 5.

◆ GlobalSPTRs

List<SourcePathTrimRule> GlobalSPTRs = new List<SourcePathTrimRule>()
static

List of trim definitions for portions of source paths to be ignored

◆ GlobalSPTRsReadFromConfig

bool GlobalSPTRsReadFromConfig = false
static

Flag to determine if global rules have been read from config already

◆ lastSourceFile

SourceFile lastSourceFile
protected

The last source file used. This is tried first with next invocation. If it does not match, the cache is searched for another matching one.

◆ LocalSPTRs

List<SourcePathTrimRule> LocalSPTRs = new List<SourcePathTrimRule>()

List of trim definitions for portions of source paths to be ignored

◆ loxName

String loxName
protected

The name of the Lox we are attached to

◆ scopes

List<Scope> scopes = new List<Scope>()
protected

A stack of scopes (allows recursive calls/nested logging)

◆ thread

Thread thread
protected

The thread that executed the log.

◆ threadDictionary

Dictionary<int, String> threadDictionary =new Dictionary<int, String>()

Dictionary to translate thread IDs into something maybe nicer/shorter. The dictionary may be filled by the user of the library using Lox.MapThreadName.

◆ threadID

int threadID
protected

The id of the thread that executed the log.

◆ threadName

AString threadName = new AString(32)
protected

The name of the thread that executed the log.


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