Add preference option for adding timestamp to log messages. Helpful for debugging performance issues.

This commit is contained in:
Ansgar Becker
2022-10-20 18:47:10 +02:00
parent fb2668b48c
commit 59bb389650
5 changed files with 22 additions and 5 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: HeidiSQL\n" "Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n" "POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2022-10-03 08:54+0200\n" "PO-Revision-Date: 2022-10-20 18:45+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n" "Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n" "Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"Language: en\n" "Language: en\n"
@ -2802,6 +2802,9 @@ msgstr "Enable query history"
msgid "days to keep queries before removing them" msgid "days to keep queries before removing them"
msgstr "days to keep queries before removing them" msgstr "days to keep queries before removing them"
msgid "Add timestamp to all log messages"
msgstr "Add timestamp to all log messages"
#. optionsform..pagecontrolMain..tabSQL..lblFont..Caption #. optionsform..pagecontrolMain..tabSQL..lblFont..Caption
#: options.dfm:357 #: options.dfm:357
msgid "Editor font:" msgid "Editor font:"

View File

@ -192,7 +192,7 @@ type
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize, asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme, asIconPack, asWebSearchBaseUrl, asTheme, asIconPack, asWebSearchBaseUrl,
asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors, asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors,
asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asLogScript, asFieldColorNumeric, asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asLogScript, asLogTimestamp, asFieldColorNumeric,
asFieldColorReal, asFieldColorText, asFieldColorBinary, asFieldColorDatetime, asFieldColorSpatial, asFieldColorReal, asFieldColorText, asFieldColorBinary, asFieldColorDatetime, asFieldColorSpatial,
asFieldColorOther, asFieldEditorBinary, asFieldEditorDatetime, asFieldEditorDatetimePrefill, asFieldEditorEnum, asFieldColorOther, asFieldEditorBinary, asFieldEditorDatetime, asFieldEditorDatetimePrefill, asFieldEditorEnum,
asFieldEditorSet, asFieldNullBackground, asRowBackgroundEven, asRowBackgroundOdd, asGroupTreeObjects, asDisplayObjectSizeColumn, asSQLfile, asFieldEditorSet, asFieldNullBackground, asRowBackgroundEven, asRowBackgroundOdd, asGroupTreeObjects, asDisplayObjectSizeColumn, asSQLfile,
@ -3753,6 +3753,7 @@ begin
InitSetting(asLogScript, 'LogScript', 0, False); InitSetting(asLogScript, 'LogScript', 0, False);
InitSetting(asLogInfos, 'LogInfos', 0, True); InitSetting(asLogInfos, 'LogInfos', 0, True);
InitSetting(asLogDebug, 'LogDebug', 0, False); InitSetting(asLogDebug, 'LogDebug', 0, False);
InitSetting(asLogTimestamp, 'LogTimestamp', 0, False);
InitSetting(asFieldColorNumeric, 'FieldColor_Numeric', $00FF0000); InitSetting(asFieldColorNumeric, 'FieldColor_Numeric', $00FF0000);
InitSetting(asFieldColorReal, 'FieldColor_Real', $00FF0048); InitSetting(asFieldColorReal, 'FieldColor_Real', $00FF0048);
InitSetting(asFieldColorText, 'FieldColor_Text', $00008000); InitSetting(asFieldColorText, 'FieldColor_Text', $00008000);

View File

@ -5427,7 +5427,10 @@ var
begin begin
LogItem := TDBLogItem.Create; LogItem := TDBLogItem.Create;
LogItem.Category := Category; LogItem.Category := Category;
LogItem.LineText := Msg; if AppSettings.ReadBool(asLogTimestamp) then
LogItem.LineText := '['+FormatDateTime('hh:nn:ss.zzz', Now)+'] '+ Msg
else
LogItem.LineText := Msg;
LogItem.Connection := Connection; LogItem.Connection := Connection;
PostponedLogItems.Add(LogItem); PostponedLogItems.Add(LogItem);

View File

@ -13,7 +13,6 @@ object frmPreferences: TfrmPreferences
Font.Height = -12 Font.Height = -12
Font.Name = 'Tahoma' Font.Name = 'Tahoma'
Font.Style = [] Font.Style = []
OldCreateOrder = False
Position = poMainFormCenter Position = poMainFormCenter
OnClose = FormClose OnClose = FormClose
OnCreate = FormCreate OnCreate = FormCreate
@ -21,7 +20,6 @@ object frmPreferences: TfrmPreferences
DesignSize = ( DesignSize = (
722 722
460) 460)
PixelsPerInch = 96
TextHeight = 14 TextHeight = 14
object pagecontrolMain: TPageControl object pagecontrolMain: TPageControl
Left = 8 Left = 8
@ -551,6 +549,15 @@ object frmPreferences: TfrmPreferences
TabOrder = 9 TabOrder = 9
OnClick = Modified OnClick = Modified
end end
object chkLogTimestamp: TCheckBox
Left = 220
Top = 292
Width = 475
Height = 17
Caption = 'Add timestamp to all log messages'
TabOrder = 16
OnClick = Modified
end
end end
object tabSQL: TTabSheet object tabSQL: TTabSheet
Caption = 'SQL' Caption = 'SQL'

View File

@ -179,6 +179,7 @@ type
editRealTrailingZeros: TEdit; editRealTrailingZeros: TEdit;
updownRealTrailingZeros: TUpDown; updownRealTrailingZeros: TUpDown;
lblRealTrailingZerosHint: TLabel; lblRealTrailingZerosHint: TLabel;
chkLogTimestamp: TCheckBox;
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject); procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject); procedure Apply(Sender: TObject);
@ -311,6 +312,7 @@ begin
AppSettings.WriteBool(asQueryHistoryEnabled, chkQueryHistory.Checked); AppSettings.WriteBool(asQueryHistoryEnabled, chkQueryHistory.Checked);
AppSettings.WriteInt(asQueryHistoryKeepDays, updownQueryHistoryKeepDays.Position); AppSettings.WriteInt(asQueryHistoryKeepDays, updownQueryHistoryKeepDays.Position);
AppSettings.WriteBool(asLogHorizontalScrollbar, chkHorizontalScrollbar.Checked); AppSettings.WriteBool(asLogHorizontalScrollbar, chkHorizontalScrollbar.Checked);
AppSettings.WriteBool(asLogTimestamp, chkLogTimestamp.Checked);
for i:=0 to SynSQLSynSQLSample.AttrCount - 1 do begin for i:=0 to SynSQLSynSQLSample.AttrCount - 1 do begin
Attri := SynSQLSynSQLSample.Attribute[i]; Attri := SynSQLSynSQLSample.Attribute[i];
AppSettings.WriteInt(asHighlighterForeground, Attri.Foreground, Attri.Name); AppSettings.WriteInt(asHighlighterForeground, Attri.Foreground, Attri.Name);
@ -683,6 +685,7 @@ begin
chkQueryHistory.Checked := AppSettings.ReadBool(asQueryHistoryEnabled); chkQueryHistory.Checked := AppSettings.ReadBool(asQueryHistoryEnabled);
updownQueryHistoryKeepDays.Position := AppSettings.ReadInt(asQueryHistoryKeepDays); updownQueryHistoryKeepDays.Position := AppSettings.ReadInt(asQueryHistoryKeepDays);
chkHorizontalScrollbar.Checked := AppSettings.ReadBool(asLogHorizontalScrollbar); chkHorizontalScrollbar.Checked := AppSettings.ReadBool(asLogHorizontalScrollbar);
chkLogTimestamp.Checked := AppSettings.ReadBool(asLogTimestamp);
// Default column width in grids: // Default column width in grids:
updownMaxColWidth.Position := AppSettings.ReadInt(asMaxColWidth); updownMaxColWidth.Position := AppSettings.ReadInt(asMaxColWidth);