aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authoreddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-22 21:05:11 +0000
committereddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-22 21:05:11 +0000
commit3d2e9f4f029c5bb8868bb438d677c724ff6a2609 (patch)
tree6665889d93414a17451d91b50e825f6a27ae795e /Game/Code/Classes
parentd1561b43c1eedb2e6fd30ad4096fa3fa6c5c187b (diff)
downloadusdx-3d2e9f4f029c5bb8868bb438d677c724ff6a2609.tar.gz
usdx-3d2e9f4f029c5bb8868bb438d677c724ff6a2609.tar.xz
usdx-3d2e9f4f029c5bb8868bb438d677c724ff6a2609.zip
Added LogBuffer to dump binary data to a file.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@628 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/ULog.pas19
1 files changed, 19 insertions, 0 deletions
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index 7f0b82c4..ac08f2d5 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -45,6 +45,7 @@ type
// compability
procedure LogStatus(Log1, Log2: string);
procedure LogError(Log1, Log2: string); overload;
+ procedure LogBuffer(const buf : Pointer; const bufLength : Integer; filename : string);
end;
var
@@ -256,6 +257,24 @@ begin
Halt;
end;
+procedure TLog.LogBuffer(const buf: Pointer; const bufLength: Integer; filename: string);
+var
+ f : TFileStream;
+begin
+ f := nil;
+
+ try
+ f := TFileStream.Create( filename, fmCreate);
+ f.Write( buf^, bufLength);
+ f.Free;
+ except
+ on e : Exception do begin
+ Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename + '". ErrMsg: ' + e.Message);
+ f.Free;
+ end;
+ end;
+end;
+
end.