1
0
mirror of synced 2024-12-03 16:13:09 +01:00

Added: Category is now added to log files

This commit is contained in:
Mark van Renswoude 2014-10-22 09:38:51 +00:00
parent c5bb17cb86
commit d7b18972c3
2 changed files with 26 additions and 4 deletions

View File

@ -21,14 +21,32 @@ resourcestring
X2Log.Observer.LogFile
}
{ The format of the log line without a category
0: Message
}
LogFileLineNoCategory = '%0:s';
{ The format of the log line with a category
0: Message
1: Category
}
LogFileLineCategory = '%1:s: %0:s';
{ Date format used to determine the file name of detail files }
LogFileNameDateFormat = 'yyyymmdd_hhnn';
{ Date format used in log files }
LogFileLineDateFormat = 'yyyy-mm-dd hh:nn';
{ The text added to the message if details are stored externally }
LogFileLineDetails = ' (details: %s)';
{ The format of the log message when details are stored externally
0: Message
1: Details filename
}
LogFileLineDetails = '%0:s (details: %1:s)';
{

View File

@ -117,7 +117,11 @@ var
begin
ForceDirectories(ExtractFilePath(FileName));
errorMsg := AEntry.Message;
if Length(AEntry.Category) > 0 then
errorMsg := Format(GetLogResourceString(@LogFileLineCategory), [AEntry.Message, AEntry.Category])
else
errorMsg := Format(GetLogResourceString(@LogFileLineNoCategory), [AEntry.Message]);
if Supports(AEntry.Details, IX2LogDetailsStreamable, logDetailsStreamable) then
begin
@ -160,7 +164,7 @@ begin
// ErrorLogs.Add(reportFileName);
errorMsg := errorMsg + Format(GetLogResourceString(@LogFileLineDetails), [ExtractFileName(detailsFileName)]);
errorMsg := Format(GetLogResourceString(@LogFileLineDetails), [errorMsg, ExtractFileName(detailsFileName)]);
break;
end;
until False;