Home / Simple LogFile
Name Modified Size InfoDownloads / Week
Parent folder
ReadMe.md 2024-04-13 1.2 kB
SimpleLogFile.PAS 2024-04-12 2.8 kB
Totals: 2 Items   4.0 kB 0

Simple LogFile

The purpose of this unit is to provide a possibility to create and maintain a simple logfile.

Usage

The 'Interface' part of the unit looks as follows (the documentation is self explaining):

interface

uses Classes, SysUtils, RcsDirectories;

const Extension = '.log';

{ The logfile always resides in the startup directory of the application.
The name of the logfile used depends on the value of the "No" parameter.
If the parameter is zero (the default), then the logfilename is simply the
name of the application (without its extension) with extension ".log"
(e.g. "Application.log".)
If "No" is > 0 then the same is valid but in the logfilename also "No"
is incorporated, e.g. "Application15.log" (if No = 15).
}

procedure AddToLogFile(S: String; No: Integer = 0); overload;
// Appends "S" to the logfile

procedure AddToLogFile(S: TStrings; No: Integer = 0); overload;
// Appends all lines in "S" to the logfile

procedure ClearLogFile(No: Integer = 0);
// Empties the logfile

function  LogFileName(No: Integer = 0): string;
// Returns the name of the logfile, e.g. for viewing purposes

Have fun!

Source: ReadMe.md, updated 2024-04-13