2014-05-18 18:09:07 +00:00
|
|
|
unit X2Log.Constants;
|
|
|
|
|
|
|
|
interface
|
|
|
|
uses
|
|
|
|
X2Log.Intf;
|
|
|
|
|
|
|
|
|
|
|
|
resourcestring
|
|
|
|
LogLevelVerbose = 'Verbose';
|
|
|
|
LogLevelInfo = 'Info';
|
|
|
|
LogLevelWarning = 'Warning';
|
|
|
|
LogLevelError = 'Error';
|
|
|
|
|
2014-10-20 12:07:44 +00:00
|
|
|
LogCategorySeparator = ' - ';
|
|
|
|
|
|
|
|
// Note: currently not translatable
|
|
|
|
LogCategoryDefault = '';
|
|
|
|
|
2014-05-18 18:09:07 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
X2Log.Observer.LogFile
|
|
|
|
}
|
|
|
|
|
2014-10-22 09:38:51 +00:00
|
|
|
{ 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';
|
|
|
|
|
|
|
|
|
2014-05-18 18:09:07 +00:00
|
|
|
{ Date format used to determine the file name of detail files }
|
2014-06-23 18:40:33 +00:00
|
|
|
LogFileNameDateFormat = 'yyyymmdd_hhnn';
|
2014-05-18 18:09:07 +00:00
|
|
|
|
|
|
|
{ Date format used in log files }
|
2014-06-23 18:40:33 +00:00
|
|
|
LogFileLineDateFormat = 'yyyy-mm-dd hh:nn';
|
2014-05-18 18:09:07 +00:00
|
|
|
|
2014-10-22 09:38:51 +00:00
|
|
|
{ The format of the log message when details are stored externally
|
|
|
|
|
|
|
|
0: Message
|
|
|
|
1: Details filename
|
|
|
|
}
|
|
|
|
LogFileLineDetails = '%0:s (details: %1:s)';
|
2014-05-18 18:09:07 +00:00
|
|
|
|
2016-10-15 09:22:51 +00:00
|
|
|
{ The format of the log message when structured information is present
|
|
|
|
|
|
|
|
0: Message
|
|
|
|
1: Comma-separated key-value pairs
|
|
|
|
}
|
|
|
|
LogFileLineStructured = '%0:s [%1:s]';
|
2014-05-18 18:09:07 +00:00
|
|
|
|
2015-03-06 11:51:59 +00:00
|
|
|
{
|
|
|
|
X2Log.Observer.RollingLogFile
|
|
|
|
}
|
|
|
|
|
|
|
|
{ Date format used in the rolling log file's file name }
|
|
|
|
RollingLogFileDateFormat = 'yyyy.mm.dd';
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-05-20 08:49:57 +00:00
|
|
|
{
|
|
|
|
X2Log.Observer.MonitorForm
|
|
|
|
}
|
|
|
|
|
|
|
|
{ Caption of the monitor form. %s is optional and will be replaced
|
|
|
|
with the application's title }
|
|
|
|
LogMonitorFormCaption = '%s - Live Log';
|
|
|
|
|
|
|
|
{ Caption of the columns in the live log view }
|
|
|
|
LogMonitorFormColumnTime = 'Time';
|
2014-10-20 12:07:44 +00:00
|
|
|
LogMonitorFormColumnCategory = 'Category';
|
2014-05-20 08:49:57 +00:00
|
|
|
LogMonitorFormColumnMessage = 'Message';
|
|
|
|
|
2014-05-20 09:19:04 +00:00
|
|
|
{ Caption of the toolbar buttons }
|
|
|
|
LogMonitorFormButtonClear = 'Clear';
|
2014-05-31 20:47:52 +00:00
|
|
|
LogMonitorFormButtonPause = 'Pause';
|
2014-05-20 19:17:23 +00:00
|
|
|
LogMonitorFormButtonCopyDetails = 'Copy';
|
2014-05-20 09:19:04 +00:00
|
|
|
LogMonitorFormButtonSaveDetails = 'Save';
|
2014-10-08 12:33:11 +00:00
|
|
|
LogMonitorFormButtonWordWrapDetails = 'Word wrap';
|
2014-05-20 09:19:04 +00:00
|
|
|
|
2014-05-31 20:47:52 +00:00
|
|
|
LogMonitorFormButtonFilter = 'Filter:';
|
|
|
|
|
2014-10-08 12:33:11 +00:00
|
|
|
{ Caption of the menu items which are not on the toolbar }
|
|
|
|
LogMonitorFormMenuFile = 'File';
|
|
|
|
LogMonitorFormMenuFileSaveAs = 'Save as...';
|
|
|
|
LogMonitorFormMenuFileClose = 'Close';
|
|
|
|
LogMonitorFormMenuLog = 'Log';
|
|
|
|
LogMonitorFormMenuDetails = 'Details';
|
|
|
|
LogMonitorFormMenuWindow = 'Window';
|
|
|
|
LogMonitorFormMenuWindowAlwaysOnTop = 'Always on top';
|
|
|
|
|
2018-02-15 15:46:28 +00:00
|
|
|
{ Caption of the details view headers }
|
|
|
|
LogMonitorFormMessageHeader = 'Message';
|
|
|
|
LogMonitorFormDetailHeader = 'Details';
|
|
|
|
LogMonitorFormKeyHeader = 'Key';
|
|
|
|
LogMonitorFormValueHeader = 'Value';
|
|
|
|
|
2014-10-08 12:33:11 +00:00
|
|
|
|
2014-05-20 19:17:23 +00:00
|
|
|
{ Status messages }
|
|
|
|
LogMonitorFormStatusPaused = 'Paused: %d log message(s) skipped';
|
|
|
|
|
2014-05-31 20:10:10 +00:00
|
|
|
{ Filter for Save details buttons }
|
2014-05-30 12:51:01 +00:00
|
|
|
LogMonitorFormSaveDetailsFilter = 'All files (*.*)|*.*';
|
|
|
|
|
2014-10-08 12:33:11 +00:00
|
|
|
{ Filter for Save as menu item }
|
|
|
|
LogMonitorFormSaveDetailsSaveAs = 'Log files (*.log)|*.log|All files (*.*)|*.*';
|
|
|
|
|
2014-05-20 08:49:57 +00:00
|
|
|
|
2014-05-18 18:09:07 +00:00
|
|
|
function GetLogLevelText(ALogLevel: TX2LogLevel): string;
|
|
|
|
|
|
|
|
function GetLogResourceString(AResourceString: Pointer): string;
|
|
|
|
procedure SetLogResourceString(AResourceString: Pointer; const AValue: string);
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
uses
|
|
|
|
System.Generics.Collections,
|
|
|
|
System.SysUtils;
|
|
|
|
|
|
|
|
|
2014-05-31 20:10:10 +00:00
|
|
|
type
|
|
|
|
TResourceStringDictionary = TDictionary<Pointer,string>;
|
|
|
|
|
2014-05-18 18:09:07 +00:00
|
|
|
var
|
2014-05-31 20:10:10 +00:00
|
|
|
LogResourceStringMap: TResourceStringDictionary;
|
2014-05-18 18:09:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function GetLogLevelText(ALogLevel: TX2LogLevel): string;
|
|
|
|
begin
|
|
|
|
case ALogLevel of
|
|
|
|
TX2LogLevel.Verbose: Result := GetLogResourceString(@LogLevelVerbose);
|
|
|
|
TX2LogLevel.Info: Result := GetLogResourceString(@LogLevelInfo);
|
|
|
|
TX2LogLevel.Warning: Result := GetLogResourceString(@LogLevelWarning);
|
|
|
|
TX2LogLevel.Error: Result := GetLogResourceString(@LogLevelError);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function GetLogResourceString(AResourceString: Pointer): string;
|
|
|
|
begin
|
|
|
|
TMonitor.Enter(LogResourceStringMap);
|
|
|
|
try
|
|
|
|
if LogResourceStringMap.ContainsKey(AResourceString) then
|
|
|
|
Result := LogResourceStringMap[AResourceString]
|
|
|
|
else
|
|
|
|
Result := LoadResString(AResourceString);
|
|
|
|
finally
|
|
|
|
TMonitor.Exit(LogResourceStringMap);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure SetLogResourceString(AResourceString: Pointer; const AValue: string);
|
|
|
|
begin
|
|
|
|
TMonitor.Enter(LogResourceStringMap);
|
|
|
|
try
|
|
|
|
LogResourceStringMap.AddOrSetValue(AResourceString, AValue);
|
|
|
|
finally
|
|
|
|
TMonitor.Exit(LogResourceStringMap);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
initialization
|
2014-05-31 20:10:10 +00:00
|
|
|
LogResourceStringMap := TResourceStringDictionary.Create;
|
2014-05-18 18:09:07 +00:00
|
|
|
|
|
|
|
finalization
|
|
|
|
FreeAndNil(LogResourceStringMap);
|
|
|
|
|
|
|
|
end.
|