threadsafelog Log property
Return to Introduction  Previous page  Next page
Applies to
acThreadSafeLog component.  

procedure Log(const Text: String); overload;  
procedure Log(Int: Int64); overload;  
procedure Log(Ext: Extended); overload;  

The Log method appends new line of Text to the log file specified in the FileName property, plus can add the same line to some Memo control if it's specified.  
You can call this method from any place and any thread of your application without worrying about synchronization between threads. Everything will be logged as charm, none byte will be lost, none memory access violation will be occur.  
To call Log method, you need to specify some Text (or integer value which will be automatically converted to text). The component will append this text to the file specified in the FileName property (if LogToFile is True), or to some Memo control (if the controls specified and LogToMemo is True).  
tip When the component is about to append specified text to the log, it also puts special prefix before the text. The prefix may contain current date and time, the identifier of calling thread, or number of CPU ticks passed from application startup (see Options property for more details). If you don't want to automatically add the prefix before logged text, you may set all of Options to False, or specify your own custom prefix in the OnCustomPrefix event handler.  

See also
FileName, Memo, LogToFile, LogToMemo and Options property;  
OnCustomPrefix event.