aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbasisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c>2015-08-15 01:23:56 +0000
committerbasisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c>2015-08-15 01:23:56 +0000
commitef87526bdda394dff43fa3600a4c6936508e3791 (patch)
treea97063cdc69a8b95eb0b37f6b6db70c4dcb017a7
parent0beaaf7f95866304a9cde8f279ad0b0b25335e63 (diff)
downloadusdx-ef87526bdda394dff43fa3600a4c6936508e3791.tar.gz
usdx-ef87526bdda394dff43fa3600a4c6936508e3791.tar.xz
usdx-ef87526bdda394dff43fa3600a4c6936508e3791.zip
*added try catch on UMain.Main for better overall error handling
*added SetLogFileLevel and GetLogFileLevel for easier debugging (logging more to file) *if (LogFileLevel < LogLevel) then still do logging if important error message git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3117 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/base/UConfig.pas10
-rw-r--r--src/base/ULog.pas16
-rw-r--r--src/ultrastardx.dpr12
3 files changed, 34 insertions, 4 deletions
diff --git a/src/base/UConfig.pas b/src/base/UConfig.pas
index e48b5493..23ef0f3f 100644
--- a/src/base/UConfig.pas
+++ b/src/base/UConfig.pas
@@ -203,6 +203,16 @@ const
(LIBSAMPLERATE_VERSION_RELEASE * VERSION_RELEASE);
{$ENDIF}
+ {$IFNDEF lua_VERSION_MAJOR}
+ LUA_VERSION_MAJOR = '5';
+ {$ENDIF}
+ {$IFNDEF lua_VERSION_MINOR}
+ LUA_VERSION_MINOR = '1';
+ {$ENDIF}
+ {$IFNDEF lua_VERSION_RELEASE}
+ LUA_VERSION_RELEASE = '4';
+ {$ENDIF}
+
function USDXVersionStr(): string;
function USDXShortVersionStr(): string;
diff --git a/src/base/ULog.pas b/src/base/ULog.pas
index ea3cda4e..bde4d4e4 100644
--- a/src/base/ULog.pas
+++ b/src/base/ULog.pas
@@ -100,6 +100,8 @@ type
procedure SetLogLevel(Level: integer);
function GetLogLevel(): integer;
+ procedure SetLogFileLevel(Level: integer);
+ function GetLogFileLevel(): integer;
procedure LogMsg(const Text: string; Level: integer); overload;
procedure LogMsg(const Msg, Context: string; Level: integer); overload; {$IFDEF HasInline}inline;{$ENDIF}
@@ -311,13 +313,21 @@ begin
Result := LogLevel;
end;
+procedure TLog.SetLogFileLevel(Level: integer);
+begin
+ LogFileLevel := Level;
+end;
+
+function TLog.GetLogFileLevel(): integer;
+begin
+ Result := LogFileLevel;
+end;
+
procedure TLog.LogMsg(const Text: string; Level: integer);
var
LogMsg: string;
begin
- // TODO: what if (LogFileLevel < LogLevel)? Log to file without printing to
- // console or do not log at all? At the moment nothing is logged.
- if (Level <= LogLevel) then
+ if ((Level <= LogLevel) or (Level <= LogFileLevel)) then
begin
if (Level <= LOG_LEVEL_CRITICAL_MAX) then
LogMsg := 'CRITICAL: ' + Text
diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr
index 0523f818..2280d4c6 100644
--- a/src/ultrastardx.dpr
+++ b/src/ultrastardx.dpr
@@ -350,7 +350,17 @@ uses
SysUtils;
+const
+ sLineBreak = {$IFDEF LINUX} AnsiChar(#10) {$ENDIF}
+ {$IFDEF MSWINDOWS} AnsiString(#13#10) {$ENDIF};
begin
- Main;
+ try
+ Main;
+ except
+ on E : Exception do
+ begin
+ ShowMessage('Exception class name = '+E.ClassName+sLineBreak+'Exception message = '+E.Message);
+ end;
+ end;
end.