siliziumbrain.errorlogger: | Types | Modinfo | Source |
TErrorLogger | Error Logger to wirte error files. |
TErrorMessage | Class for the messages the errorlogger uses. |
TLogLevel | Class for the loglevels. |
TLogMessage | Class for the messages the errorlogger uses. |
Type TErrorLogger Extends TObject | |
Description | Error Logger to wirte error files. |
Information | It allows to have multiple Error-Log files (one for each instance). It provides an simple way of logging nicely formatted errors. |
Methods Summary | |
---|---|
__CondVar | Private method. Do not use! |
__IsFinished | Private method. Do not use! |
__MessageQueue | Private method. Do not use! |
__Mutex | Private method. Do not use! |
__SetCondVar | Private method. Do not use! |
__SetIsFinished | Private method. Do not use! |
__SetMessageQueue | Private method. Do not use! |
__SetMutex | Private method. Do not use! |
__SetUpdateThread | Private method. Do not use! |
__UpdateThread | Private method. Do not use! |
ChangeCurrentErrorLevel | Setter for the current error level. |
Copy | Copies the object. |
CurrentErrorLevel | Getter for the current error level. |
Equals | Checks if two objects are equal. |
HasFinishedWriting | Checks if the logger is still writing logs. |
Log_Error | Logs an error. |
Log_Message | Logs a simple message. |
Log_NewLine | Just logs an empty line. |
New | Do NOT! use. Constructor. |
Functions Summary | |
---|---|
Instance | Returns the instance of the TErrorLogger class. |
Update | Updates the error logger. |
Method __CondVar:TCondVar() | |
Description | Private method. Do not use! |
Information | Getter for the cond var (for multithreading). |
Method __IsFinished:Byte() | |
Description | Private method. Do not use! |
Information | Getter for the is finished value. |
Method __MessageQueue:TQueue() | |
Description | Private method. Do not use! |
Information | Getter for the message queue. |
Method __Mutex:TMutex() | |
Description | Private method. Do not use! |
Information | Getter for the mutex (to use multithreading). |
Method __SetCondVar(ptcvCondVar:TCondVar) | |
Description | Private method. Do not use! |
Information | Setter for the cond var. |
Method __SetIsFinished(pbIsFinished:Byte) | |
Description | Private method. Do not use! |
Information | Setter for the is finished value. |
Method __SetMessageQueue(ptQueue:TQueue) | |
Description | Private method. Do not use! |
Information | Setter for the message queue. |
Method __SetMutex(ptmMutex:TMutex) | |
Description | Private method. Do not use! |
Information | Setter for the mutex. |
Method __SetUpdateThread(pttUpdateThread:TThread) | |
Description | Private method. Do not use! |
Information | Setter for the update thread. |
Method __UpdateThread:TThread() | |
Description | Private method. Do not use! |
Information | Getter for the update thread. |
Method ChangeCurrentErrorLevel(piNewErrorLevel:Int) | |
Description | Setter for the current error level. |
Information | Changes the current error level (#CurrentErrorLevel) to piNewErrorLevel. |
Method Copy:TErrorLogger() | |
Description | Copies the object. |
Information | Had to been implemented because of TObject. returns: Just the instance. |
Method CurrentErrorLevel:TLogLevel() | |
Description | Getter for the current error level. |
Information | The current error level tells the logger which errors should be logged. returns: The current error level (#TLogLevel). |
Method Equals:Byte(ptoOtherObject:TObject) | |
Description | Checks if two objects are equal. |
Information | Had to been implemented because of TObject. |
Method HasFinishedWriting:Byte() | |
Description | Checks if the logger is still writing logs. |
Information | This is needed to decide if a programm may end. You have to wait until this returns true. |
Method Log_Error(psMessage:String, psCategory:String, psComesFromFile:String, psFileToWriteIn:String, piLogLevel:Int, poUsedObject:Object = Null) | |
Description | Logs an error. |
Information | Use this method to log an error. psMessage is the error message self. psCategory is the category to which the error belongs. psComesFromFile is the filename where the error occurred. psFileToWriteIn is the path to the file where the error should be written into. piLogLevel is the error level of the logged error. poUsedObject can be an object which was used when an error occurred. If it is null, nothing about the object is written. |
Method Log_Message(psMessage:String, psCategory:String, psFileToWriteIn:String, piLogLevel:Int) | |
Description | Logs a simple message. |
Information | Use this method to log a simple message without many information. psMessage is the message self. psCategory is the category to which the message belongs. psFileToWriteIn is the path to the file where the message should be written into. piLogLevel is the message level(<=> error level) of the logged message. |
Method Log_NewLine(psFileToWriteIn:String, piLogLevel:Int) | |
Description | Just logs an empty line. |
Information | Use this method if you want to have an empty line. psFileToWriteIn is the path to the file where the message should be written into. piLogLevel is the message level(<=> error level) of the logged message. |
Method New() | |
Description | Do NOT! use. Constructor. |
Information | Constructor for an errorlogger. This should be only used by the class itself. |
Function Instance:TErrorLogger() | |
Description | Returns the instance of the TErrorLogger class. |
Information | This is needed because the class is a singleton. |
Function Update:Object(ptelLogger:Object) | |
Description | Updates the error logger. |
Information | This function runs in an own thread. returns: Nothing. |
Type TErrorMessage Extends TObject | |
Description | Class for the messages the errorlogger uses. |
Information | The TErrorLogger uses errormessages to log the errors. |
Methods Summary | |
---|---|
__SetCategory | Private method. Do not use! |
__SetComesFromFile | Private method. Do not use! |
__SetFileToWriteIn | Private method. Do not use. |
__SetLogLevel | Private method. Do not use! |
__SetMessage | Private method. Do not use! |
__SetObjectString | Private method. Do not use! |
__SetTimeWhenCreated | Private method. Do not use! |
Category | Getter for the category. |
ComesFromFile | Getter for the filename where the error occurred. |
Copy | Copies the object. |
Equals | Checks if two messages are equal. |
FileToWriteIn | Getter for the path of the destination file. |
LogLevel | Getter for the loglevel. |
Message | Getter for the message. |
NewLogMessage | Constructor. |
ObjectString | Getter for the object string. |
TimeWhenCreated | Getter for the time when the message was created. |
ToString | Returns the message as a string. |
Method __SetCategory(psCategory:String) | |
Description | Private method. Do not use! |
Information | Sets the category of the message to psCategory. |
Method __SetComesFromFile(psComesFromFile:String) | |
Description | Private method. Do not use! |
Information | Sets the filename where the message comes from to psComesFromFile. |
Method __SetFileToWriteIn(psFileToWriteIn:String) | |
Description | Private method. Do not use. |
Information | Sets the path of the destination file to psFileToWriteIn. |
Method __SetLogLevel(ptllLogLevel:TLogLevel) | |
Description | Private method. Do not use! |
Information | Sets the loglevel of the message to ptllLogLevel. |
Method __SetMessage(psMessage:String) | |
Description | Private method. Do not use! |
Information | Sets the given message to psMessage. |
Method __SetObjectString(psObjectString:String) | |
Description | Private method. Do not use! |
Information | Sets the object string to psObjectString. |
Method __SetTimeWhenCreated(psTimeWhenCreated:String) | |
Description | Private method. Do not use! |
Information | Sets the time when the message was created to psTimeWhenCreated. |
Method Category:String() | |
Description | Getter for the category. |
Information | This method returns the category of the message. returns: The category of the message. |
Method ComesFromFile:String() | |
Description | Getter for the filename where the error occurred. |
Information | This method returns the filename of the file where the error occured, so where the message comes from. returns: Filename of the file where the message comes from. |
Method Copy:TErrorMessage() | |
Description | Copies the object. |
Information | Had to been implemented because of TObject. |
Method Equals:Byte(ptoOtherObject:TObject) | |
Description | Checks if two messages are equal. |
Information | Checks if ptoOtherObject and the message which called this method are equal. returns: True if equal, otherwise false. |
Method FileToWriteIn:String() | |
Description | Getter for the path of the destination file. |
Information | This method returns the path to the file where the message should be written in. returns: The path of the destination file. |
Method LogLevel:TLogLevel() | |
Description | Getter for the loglevel. |
Information | This method returns the loglevel (#TLogLevel) of the message. returns: The loglevel of the message. |
Method Message:String() | |
Description | Getter for the message. |
Information | This method returns the given message. returns: The given message. |
Method NewLogMessage:TErrorMessage(psMessage:String, psCategory:String, psFileToWriteIn:String, psComesFromFile:String, piLogLevel:Int, psObjectString:String = "") | |
Description | Constructor. |
Information | Creates a new TErrorMessage. psMessage is the given message. psCategory is the category. psFileToWriteIn is the path of the destination file. psComesFromFile is the filename of the file message comes from. piLogLevel is the loglevel. psObjectString is the string of the used object. |
Method ObjectString:String() | |
Description | Getter for the object string. |
Information | This method returns the string of the used object. returns: The string of the object which was used. |
Method TimeWhenCreated:String() | |
Description | Getter for the time when the message was created. |
Information | This method returns the time when the message was created as a string. returns: The time when the message was created. |
Method ToString:String() | |
Description | Returns the message as a string. |
Type TLogLevel Extends TObject | |
Description | Class for the loglevels. |
Information | This class is used to specify the seriousness of errors which are logged. |
Constants Summary | |
---|---|
LOGLEVEL_COUNT , LOGLEVEL_DEBUGGING , LOGLEVEL_FATALONLY , LOGLEVEL_NORMALERRORS |
Methods Summary | |
---|---|
__SetLevel | Private method. Do not use! |
Copy | Copies the object. |
Equals | Checks if this loglevel and another Object are equal. |
Level | Getter for the Level. |
NewLogLevel | Constructor. |
ToString | Returns the loglevel as a string. |
Const LOGLEVEL_COUNT:Int | |
Description | The amount of loglevels. |
Const LOGLEVEL_DEBUGGING:Int | |
Description | Everything is logged. |
Const LOGLEVEL_FATALONLY:Int | |
Description | Only fatal errors are logged. |
Const LOGLEVEL_NORMALERRORS:Int | |
Description | Normal logging. Not only fatal errors but even not everything. |
Method __SetLevel(piLevel:Int) | |
Description | Private method. Do not use! |
Information | Sets the level of the loglevel to piLevel. If the given value is too big or too small, then it adjusted. |
Method Copy:TObject() | |
Description | Copies the object. |
Information | Had to been implemented because of TObject. |
Method Equals:Byte(ptoOtherObject:TObject) | |
Description | Checks if this loglevel and another Object are equal. |
Information | Checks if this loglevel and ptoOtherObject are equal. returns: True if equal, otherwise false. |
Method Level:Int() | |
Description | Getter for the Level. |
Information | This method returns the level of the Loglevel. returns: The level of the loglevel. |
Method NewLogLevel:TLogLevel(piLevel:Int) | |
Description | Constructor. |
Information | Creates a new TLogLevel and sets its level to piLevel. |
Method ToString:String() | |
Description | Returns the loglevel as a string. |
Type TLogMessage Extends TErrorMessage | |
Description | Class for the messages the errorlogger uses. |
Information | The TErrorLogger uses logmessages to log simple messages. |
Methods Summary | |
---|---|
Copy | Copies the object. |
Equals | Checks if two messages are equal. |
NewMessage | Constructor. |
ToString | Returns the message as a string. |
Method Copy:TErrorMessage() | |
Description | Copies the object. |
Method Equals:Byte(ptoOtherObject:TObject) | |
Description | Checks if two messages are equal. |
Information | Checks if ptoOtherObject and the message which called this method are equal. returns: True if equal, otherwise false. |
Method NewMessage:TLogMessage(psMessage:String, psCategory:String, psFileToWriteIn:String, piLogLevel:Int) | |
Description | Constructor. |
Information | Creates a new TErrorMessage. psMessage is the given message. psCategory is the category. psFileToWriteIn is the path of the destination file. piLogLevel is the loglevel. |
Method ToString:String() | |
Description | Returns the message as a string. |
Version | v1.20 |
---|---|
Author | M0rgenstern - Siliziumbrain - Kevin Peter Hoffeld |
License | Public Domain |
History v1.00 | 01 March 2012 - Final Release |
History v1.10 | 14 July 2012 - MultiThreading and Singleton. |
History v1.20 | 15 July 2012 - Simple messages can now be logged if only information are needed but no error occured. Also: Fixed the HasFinishedWriting method. Also: Added possibility to log empty lines. |