Home › Forums › CodeSite › Code Site Limitations and Annoyances for Client Server and Service Development › Reply To: Code Site Limitations and Annoyances for Client Server and Service Development
August 8, 2019 at 12:23 pm
#1439
Warren,
I don’t know if this will help you but I use the following in a desktop application for logging to a file and the live view (if the dispatcher is running – for TCP/IP this needs to be manually started if I remember as it will not be started automatically under TCP/IP)
Const
(** A constant for the log file extension. **)
strLogExt = '.csl';
(** A constant for the AppData environment variable. **)
strAppDataEnviroVar = 'AppData';
(** A constant for the Seasons Fall subdirectory under AppData. **)
strSeasonFallDir = '\Season''s Fall\XER Tools\';
(** ISO Date format for the CSL files. **)
strFileDateFmt = ' yyyy-mm-dd';
Var
(** A local private variable for the FileDestination CodeSiteLogger. **)
FileDest: TCodeSiteDestination;
(** This section creates a file based CodeSite Logger for the applciation in the same directory. **)
Initialization
FileDest := TCodeSiteDestination.Create(Nil);
FileDest.LogFile.Active := True;
FileDest.LogFile.FilePath := System.SysUtils.GetEnvironmentVariable(strAppDataEnviroVar) +
strSeasonFallDir;
FileDest.LogFile.FileName := ChangeFileExt(ExtractFileName(ParamStr(0)),
FormatDateTime(strFileDateFmt, Now()) + strLogExt);
FileDest.Viewer.Active := True;
CodeSite.Destination := FileDest;
CodeSiteLogging.CodeSiteManager.ConnectUsingTcp();
(** Frees the file based logger. **)
Finalization
FileDest.Free;
End.
- This reply was modified 4 years, 8 months ago by David Hoyle.