Feroc1ty
2011-02-28 14:29:35
my script has debug that writes a lot of lines, and i noticed when its off simba doesn't use NEARLY as much memory as it does with debug enabled
anyone else notice this?
anyone else notice this?
2011-02-28 14:29:35
2011-02-28 14:34:23
2011-02-28 15:27:22
2011-02-28 15:36:37
2011-02-28 15:37:21
2011-02-28 15:42:20
2011-02-28 15:48:04
2011-02-28 15:51:12
From: Floor66You can just replace all the writeln with Debug(). And then have debug have a writeln function and a save line function.
Well then what's the equivalent for GetDebugText in Simba :P I've been trying to find it >.<
2011-02-28 17:08:57
Program FileLogging;
Var
filePath: string;
newFile: integer;
Function DateOfYear: string;
var
y, m, d : Word;
months: TStringArray;
begin
months := ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
DecodeDate(date, y, m, d);
Result := (inttostr(y) + '.' + inttostr(m) + '.' + inttostr(d));
end;
Function ScriptRunTime: string;
var
S, M, H, D : integer;
begin
if GetTimeRunning < (24*60*60*1000) then
begin
ConvertTime(GetTimeRunning, H, M, S);
Result := ('ran for ' + IntToStr(H) + ' hrs, ' + IntToStr(M) + ' min, ' + IntToStr(S) + ' sec');
end else
begin
ConvertTime(GetTimeRunning, H, M, S);
D := Floor(H/24);
H := H mod 24;//remainder
Result := ('ran for ' + IntToStr(D) + ' days, ' + IntToStr(H) + ' hours, ' + IntToStr(M) + ' minutes, ' + IntToStr(S) + ' seconds');
end;
end;
Function TimeOfDay: string;
var
H, M, S, Ms: Word;
begin
DecodeTime(Now, H, M, S, Ms);
Result := (Padz(IntToStr(H), 2) + '.' + Padz(IntToStr(M), 2) + '.' + Padz(IntToStr(S), 2));
end;
Procedure TesterLog(action: string);
begin
WriteFileString(newFile, '... ... ... ...' + #13#10); //* In Windows #13#10 makes new line
WriteFileString(newFile, 'Net Tester ' + action + ':' + #13#10);
WriteFileString(newFile, DateOfYear + #13#10);
WriteFileString(newFile, TimeOfDay + #13#10);
if (action = 'ended') then
WriteFileString(newFile, ScriptRunTime + #13#10);
WriteFileString(newFile, '... ... ... ...' + #13#10);
end;
{**************************************************************\
* You must create the folder directory before this will work *
\**************************************************************}
Procedure StartLogging;
begin
filePath := 'C:\Simba\Logs\Tests\'; //* need to create the 'Logs' & 'Tests' before this works
newFile := CreateFile(filePath + DateOfYear + '_' + TimeOfDay + '.txt');
end;
Procedure DoStuff;
begin
Wait(1000 + random(1000));
WriteFileString(newFile, 'doing some stuff' + #13#10);
wait(1000 + random(1000));
end;
Begin
ClearDebug;
StartLogging;
TesterLog('started');
DoStuff;
TesterLog('ended');
CloseFile(newFile);
End.Program FileLoggingShimple;
Var
filePath: string;
newFile: integer;
Begin
filePath := 'C:\Simba\Logs\Tests\'; //* must create the 'Logs' & 'Tests' folders before this works
newFile := CreateFile(filePath + 'anyfilename' + '.txt');
WriteFileString(newFile, 'doing some stuff' + #13#10); //* In Windows #13#10 makes new line
CloseFile(newFile);
End.
2011-02-28 18:01:03
2011-02-28 18:11:15
2011-02-28 18:32:55
2011-02-28 19:05:07
2011-02-28 19:11:56