Logging added
This commit is contained in:
parent
f1187f30eb
commit
ecaa0883d2
|
@ -4795,14 +4795,16 @@
|
|||
comments (and was created on an Amiga?)
|
||||
|
||||
+ CTRL-Z and [ESCAPE] now both bring up the full screen editor prompt to
|
||||
save, etc.
|
||||
save, etc. I did a lot of research with old softwares and editors, and
|
||||
found this approach to be the common ground between everything ever. :)
|
||||
|
||||
+ Revampped message quoting a little bit. Quoted text will now be auto
|
||||
reformatted if adding the initials would cut off text in the original
|
||||
message EXCEPT when quoting quoted text.
|
||||
|
||||
Quote initials will always be 2 characters now. If the User handle has a
|
||||
single word handle, Mystic will use the first two letters of their name.
|
||||
Quote initials will always be 2 characters now. In an effort to better
|
||||
"standardize" quoting: If the User handle has a single word handle, Mystic
|
||||
will now use the first two letters of their name instead of one.
|
||||
|
||||
! Fixed a bug that could corrupt a message and/or crash when editing a
|
||||
message with a lot of lines.
|
||||
|
@ -4822,15 +4824,15 @@
|
|||
End
|
||||
|
||||
+ The GE menu command (edit user settings) option 14 (select theme) can now
|
||||
have a section option which specifies the base filename of a theme. For
|
||||
example, if the theme filename is "english" you can do:
|
||||
have an option which specifies the base filename of a theme. For example
|
||||
if the theme filename is "english" you can do:
|
||||
|
||||
Menu command: GE
|
||||
Data: 14 english
|
||||
|
||||
This will cause the theme to be selected automatically, without prompting
|
||||
the user for anything. If a second parameter is not supplied, the user
|
||||
will be prompted to select a theme.
|
||||
will be prompted to select a theme as usual.
|
||||
|
||||
+ Copy/Paste is now added/fixed for menu commands and menu execution lists
|
||||
in the new menu editor.
|
||||
|
@ -4850,3 +4852,37 @@
|
|||
|
||||
[General]
|
||||
autosnoop=1
|
||||
|
||||
+ Renamed the default mutil.cfg to mutil.ini since it is indeed an INI
|
||||
format file. This is just in case someone has .ini files associated with
|
||||
an editor on their OS. EXISTING USERS WILL NEED TO RENAME MUTIL.CFG TO
|
||||
MUTIL.INI unless you are supplying the filename on the command line.
|
||||
|
||||
+ Added logging into MUTIL. Add the following crap below into the
|
||||
[GENERAL] section of your configutation files if you want to use it. If
|
||||
you would like some things logged that are not please let me know, and
|
||||
vice versa. Anyway, from the new default mutil.ini:
|
||||
|
||||
; Logging option. If no directory is specified in the logfile
|
||||
; name, mUtil will attempt to use the configured LOGS directory from
|
||||
; in Mystic's configuration. To disable logging, leave the logfile
|
||||
; option commented out or set to a blank value.
|
||||
|
||||
logfile=mutil.log
|
||||
|
||||
; Level 1 = basic process logging
|
||||
; Level 2 = verbose
|
||||
|
||||
loglevel=1
|
||||
|
||||
An example of loglevel=1 logging for mUtil configured for a single
|
||||
process (mass upload) follows. I haven't tested the logging with all
|
||||
processes to get them where I want them, so please give feedback if you
|
||||
have something to suggest! :)
|
||||
|
||||
+ 09/24/12 23:11 Startup using mutil.ini
|
||||
+ 09/24/12 23:11 Process: Mass Upload Files
|
||||
+ 09/24/12 23:11 Add: mbbs_104.zip To: New File Base
|
||||
+ 09/24/12 23:11 Add: SPOT1_3B.LHA To: New File Base
|
||||
+ 09/24/12 23:11 Result: Uploaded 2 file(s)
|
||||
+ 09/24/12 23:11 Shutdown
|
||||
|
|
|
@ -63,11 +63,17 @@ Begin
|
|||
Result := True;
|
||||
|
||||
Inc (ProcessTotal);
|
||||
End;
|
||||
|
||||
Log (2, '+', ' EXEC ' + pName);
|
||||
End Else
|
||||
Log (2, '+', ' SKIP ' + pName);
|
||||
End;
|
||||
|
||||
Procedure ApplicationShutdown;
|
||||
Begin
|
||||
Log (1, '+', 'Shutdown');
|
||||
Log (1, '+', '');
|
||||
|
||||
If Assigned(Console) Then Begin
|
||||
Console.SetWindow (1, 1, 80, 25, False);
|
||||
Console.CursorXY (3, 22);
|
||||
|
@ -98,11 +104,11 @@ Begin
|
|||
If FileExist(ParamStr(1)) Then
|
||||
FN := ParamStr(1)
|
||||
Else
|
||||
If FileExist('mutil.cfg') Then
|
||||
FN := 'mutil.cfg'
|
||||
If FileExist('mutil.ini') Then
|
||||
FN := 'mutil.ini'
|
||||
Else Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('Missing file');
|
||||
ProcessStatus ('Missing file', True);
|
||||
ProcessResult (rFATAL, False);
|
||||
|
||||
Halt(1);
|
||||
|
@ -118,7 +124,7 @@ Begin
|
|||
|
||||
If IoResult <> 0 Then Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('Missing MYSTIC.DAT');
|
||||
ProcessStatus ('Missing MYSTIC.DAT', True);
|
||||
ProcessResult (rFATAL, False);
|
||||
|
||||
Halt(1);
|
||||
|
@ -129,7 +135,7 @@ Begin
|
|||
|
||||
If bbsConfig.DataChanged <> mysDataChanged Then Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('Version mismatch');
|
||||
ProcessStatus ('Version mismatch', True);
|
||||
ProcessResult (rFATAL, False);
|
||||
|
||||
Halt(1);
|
||||
|
@ -147,6 +153,13 @@ Begin
|
|||
|
||||
DirClean (TempPath, '');
|
||||
|
||||
LogFile := INI.ReadString(Header_GENERAL, 'logfile', '');
|
||||
|
||||
If (LogFile <> '') and (Pos(PathChar, LogFile) = 0) Then
|
||||
LogFile := bbsConfig.LogsPath + LogFile;
|
||||
|
||||
LogLevel := INI.ReadInteger(Header_GENERAL, 'loglevel', 1);
|
||||
|
||||
BarOne := TStatusBar.Create(3);
|
||||
BarAll := TStatusBar.Create(6);
|
||||
End;
|
||||
|
@ -163,6 +176,8 @@ Var
|
|||
Begin
|
||||
ApplicationStartup;
|
||||
|
||||
Log (1, '+', 'Startup using ' + JustFile(INI.FileName));
|
||||
|
||||
// Build process list
|
||||
|
||||
DoImportNA := CheckProcess(Header_IMPORTNA);
|
||||
|
@ -178,7 +193,7 @@ Begin
|
|||
|
||||
If ProcessTotal = 0 Then Begin
|
||||
ProcessName ('Load configuration', False);
|
||||
ProcessStatus ('No processes configured!');
|
||||
ProcessStatus ('No processes configured!', True);
|
||||
ProcessResult (rFATAL, False);
|
||||
|
||||
Halt(1);
|
||||
|
|
|
@ -42,7 +42,7 @@ Begin
|
|||
ReWrite (OutFile);
|
||||
|
||||
If IoResult <> 0 Then Begin
|
||||
ProcessStatus ('Cannot create output file');
|
||||
ProcessStatus ('Cannot create output file', True);
|
||||
ProcessResult (rWARN, True);
|
||||
|
||||
Exit;
|
||||
|
@ -51,7 +51,7 @@ Begin
|
|||
Assign (BaseFile, bbsConfig.DataPath + 'fbases.dat');
|
||||
|
||||
If Not ioReset (BaseFile, SizeOf(RecFileBase), fmRWDN) Then Begin
|
||||
ProcessStatus ('Cannot open fbases.dat');
|
||||
ProcessStatus ('Cannot open fbases.dat', True);
|
||||
ProcessResult (rWARN, True);
|
||||
|
||||
Close (OutFile);
|
||||
|
@ -135,7 +135,7 @@ Begin
|
|||
Close (BaseFile);
|
||||
Close (OutFile);
|
||||
|
||||
ProcessStatus ('Added |15' + strI2S(TotalFiles) + ' |07file(s)');
|
||||
ProcessStatus ('Added |15' + strI2S(TotalFiles) + ' |07file(s)', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ Var
|
|||
bbsConfig : RecConfig;
|
||||
TempPath : String;
|
||||
StartPath : String;
|
||||
LogFile : String;
|
||||
LogLevel : Byte = 1;
|
||||
|
||||
Const
|
||||
Header_GENERAL = 'General';
|
||||
|
@ -33,6 +35,7 @@ Const
|
|||
Header_MSGPURGE = 'PurgeMessageBases';
|
||||
Header_MSGPACK = 'PackMessageBases';
|
||||
|
||||
Procedure Log (Level: Byte; Code: Char; Str: String);
|
||||
Function strAddr2Str (Addr : RecEchoMailAddr) : String;
|
||||
Function GenerateMBaseIndex : LongInt;
|
||||
Function GenerateFBaseIndex : LongInt;
|
||||
|
@ -52,8 +55,33 @@ Uses
|
|||
DOS,
|
||||
m_Types,
|
||||
m_Strings,
|
||||
m_DateTime,
|
||||
m_FileIO;
|
||||
|
||||
Procedure Log (Level: Byte; Code: Char; Str: String);
|
||||
Var
|
||||
T : Text;
|
||||
Begin
|
||||
If LogFile = '' Then Exit;
|
||||
|
||||
If LogLevel < Level Then Exit;
|
||||
|
||||
FileMode := 66;
|
||||
|
||||
Assign (T, LogFile);
|
||||
Append (T);
|
||||
|
||||
If IoResult <> 0 Then
|
||||
If IoResult = 5 Then Exit Else ReWrite(T);
|
||||
|
||||
If Str = '' Then
|
||||
WriteLn (T, '')
|
||||
Else
|
||||
WriteLn (T, Code + ' ' + DateDos2Str(CurDateDos, 1) + ' ' + TimeDos2Str(CurDateDos, False) + ' ' + Str);
|
||||
|
||||
Close (T);
|
||||
End;
|
||||
|
||||
Function strAddr2Str (Addr : RecEchoMailAddr) : String;
|
||||
Var
|
||||
Temp : String[20];
|
||||
|
|
|
@ -35,7 +35,7 @@ Begin
|
|||
{$I-} Reset(InFile); {$I+}
|
||||
|
||||
If IoResult <> 0 Then Begin
|
||||
ProcessStatus ('Cannot find NA file');
|
||||
ProcessStatus ('Cannot find NA file', True);
|
||||
ProcessResult (rWARN, True);
|
||||
|
||||
Exit;
|
||||
|
@ -44,14 +44,14 @@ Begin
|
|||
RootDir := DirSlash(INI.ReadString(Header_FILEBONE, 'root_dir', ''));
|
||||
|
||||
If RootDir = PathSep Then Begin
|
||||
ProcessStatus ('No root directory');
|
||||
ProcessStatus ('No root directory', True);
|
||||
ProcessResult (rFATAL, True);
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
If Not DirExists(RootDir) Then Begin
|
||||
ProcessStatus ('Root directory does not exist');
|
||||
ProcessStatus ('Root directory does not exist', True);
|
||||
ProcessResult (rFATAL, True);
|
||||
|
||||
// While DirCreate can 'recursively' create, this is added to prevent
|
||||
|
@ -72,7 +72,7 @@ Begin
|
|||
BaseName := strStripLow(strStripB(Copy(Str, strWordPos(5, str, ' '), 255), ' '));
|
||||
BaseTag := strStripLow(strWordGet(2, Str, ' '));
|
||||
|
||||
ProcessStatus (BaseName);
|
||||
ProcessStatus (BaseName, False);
|
||||
|
||||
If Not IsDupeFBase(BaseTag) Then Begin
|
||||
FillChar (FBase, SizeOf(FBase), 0);
|
||||
|
@ -109,7 +109,7 @@ Begin
|
|||
|
||||
Close (InFile);
|
||||
|
||||
ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)');
|
||||
ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ Begin
|
|||
Close (BaseFile);
|
||||
End;
|
||||
|
||||
ProcessStatus ('Uploaded |15' + strI2S(FilesAdded) + ' |07file(s)');
|
||||
ProcessStatus ('Uploaded |15' + strI2S(FilesAdded) + ' |07file(s)', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Begin
|
|||
{$I-} Reset(InFile); {$I+}
|
||||
|
||||
If IoResult <> 0 Then Begin
|
||||
ProcessStatus ('Cannot find NA file');
|
||||
ProcessStatus ('Cannot find NA file', True);
|
||||
ProcessResult (rWARN, True);
|
||||
|
||||
Exit;
|
||||
|
@ -49,7 +49,7 @@ Begin
|
|||
TagName := strStripLow(strWordGet(1, Str, ' '));
|
||||
BaseName := strStripLow(strStripB(Copy(Str, Pos(' ', Str), 255), ' '));
|
||||
|
||||
ProcessStatus (BaseName);
|
||||
ProcessStatus (BaseName, False);
|
||||
|
||||
If Not IsDupeMBase(TagName) Then Begin
|
||||
FillChar (MBase, SizeOf(MBase), #0);
|
||||
|
@ -110,7 +110,7 @@ Begin
|
|||
|
||||
Close (InFile);
|
||||
|
||||
ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)');
|
||||
ProcessStatus ('Created |15' + strI2S(CreatedBases) + ' |07base(s)', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Begin
|
|||
ProcessName ('Packing Message Bases', True);
|
||||
ProcessResult (rWORKING, False);
|
||||
|
||||
ProcessStatus ('Complete');
|
||||
ProcessStatus ('Removed X Msgs in X Bases', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Begin
|
|||
ProcessName ('Purging Message Bases', True);
|
||||
ProcessResult (rWORKING, False);
|
||||
|
||||
ProcessStatus ('Complete');
|
||||
ProcessStatus ('Complete', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Type
|
|||
TProcessResult = (rDONE, rWARN, rWORKING, rFATAL);
|
||||
|
||||
Procedure ProcessName (Str: String; Start: Boolean);
|
||||
Procedure ProcessStatus (Str: String);
|
||||
Procedure ProcessStatus (Str: String; Last: Boolean);
|
||||
Procedure ProcessResult (Res: TProcessResult; Done: Boolean);
|
||||
|
||||
Implementation
|
||||
|
@ -36,21 +36,36 @@ Begin
|
|||
Inc (ProcessPos);
|
||||
|
||||
BarOne.Reset;
|
||||
|
||||
Log (1, '+', 'Process: ' + Str);
|
||||
End;
|
||||
End;
|
||||
|
||||
Procedure ProcessStatus (Str: String);
|
||||
Procedure ProcessStatus (Str: String; Last: Boolean);
|
||||
Begin
|
||||
Console.WriteXYPipe (33, Console.CursorY, 7, 31, Str);
|
||||
|
||||
If Last Then
|
||||
Log (1, '+', 'Result: ' + strStripPipe(Str))
|
||||
Else
|
||||
Log (2, '+', ' ' + Str);
|
||||
End;
|
||||
|
||||
Procedure ProcessResult (Res: TProcessResult; Done: Boolean);
|
||||
Begin
|
||||
Case Res of
|
||||
rDONE : Console.WriteXYPipe(66, Console.CursorY, 10, 11, 'DONE');
|
||||
rWARN : Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'WARNING');
|
||||
rWARN : Begin
|
||||
Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'WARNING');
|
||||
|
||||
Log (2, '!', 'Status: WARNING');
|
||||
End;
|
||||
rWORKING : Console.WriteXYPipe(66, Console.CursorY, 15, 11, 'WORKING');
|
||||
rFATAL : Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'FATAL');
|
||||
rFATAL : Begin
|
||||
Console.WriteXYPipe(66, Console.CursorY, 12, 11, 'FATAL');
|
||||
|
||||
Log (1, '!', 'Status: FATAL');
|
||||
End;
|
||||
End;
|
||||
|
||||
If Done Then Begin
|
||||
|
|
|
@ -93,7 +93,7 @@ Var
|
|||
DataLen := INI.ReadInteger (Header_TopLists, 'top' + CfgName + 'datalen', 10);
|
||||
|
||||
If Not FileExist(Template) Then Begin
|
||||
ProcessStatus('Template not found');
|
||||
ProcessStatus('Template not found', True);
|
||||
Exit;
|
||||
End;
|
||||
|
||||
|
@ -161,11 +161,11 @@ Begin
|
|||
Result := True;
|
||||
|
||||
Case ListType of
|
||||
TopCall : ProcessStatus('Top Callers');
|
||||
TopPost : ProcessStatus('Top Posts');
|
||||
TopDL : ProcessStatus('Top Downloaders');
|
||||
TopUL : ProcessStatus('Top Uploaders');
|
||||
TopPCR : ProcessStatus('Top Post/Call Ratio');
|
||||
TopCall : ProcessStatus('Top Callers', True);
|
||||
TopPost : ProcessStatus('Top Posts', True);
|
||||
TopDL : ProcessStatus('Top Downloaders', True);
|
||||
TopUL : ProcessStatus('Top Uploaders', True);
|
||||
TopPCR : ProcessStatus('Top Post/Call Ratio', True);
|
||||
End;
|
||||
|
||||
ExclName := INI.ReadString(Header_TopLists, 'exclude_list', 'exclude.txt');
|
||||
|
@ -239,7 +239,7 @@ Begin
|
|||
If INI.ReadString(Header_TopLists, 'top_ul', '0') = '1' Then GenerateList(TopUL);
|
||||
If INI.ReadString(Header_TopLists, 'top_pcr', '0') = '1' Then GenerateList(TopPCR);
|
||||
|
||||
ProcessStatus ('Created |15' + strI2S(CreatedLists) + ' |07list(s)');
|
||||
ProcessStatus ('Created |15' + strI2S(CreatedLists) + ' |07list(s)', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ Begin
|
|||
While Not Eof(BaseFile) Do Begin
|
||||
Read (BaseFile, Base);
|
||||
|
||||
ProcessStatus (Base.Name);
|
||||
ProcessStatus (Base.Name, False);
|
||||
BarOne.Update (FilePos(BaseFile), FileSize(BaseFile));
|
||||
|
||||
If Not DirExists(Base.Path) Then Continue;
|
||||
|
@ -90,6 +90,8 @@ Begin
|
|||
End;
|
||||
|
||||
If Not Found Then Begin
|
||||
Log (1, '+', ' Add: ' + DirInfo.Name + ' To: ' + strStripPipe(Base.Name));
|
||||
|
||||
Inc (FilesAdded);
|
||||
Seek (ListFile, FileSize(ListFile));
|
||||
|
||||
|
@ -172,7 +174,7 @@ Begin
|
|||
Close (BaseFile);
|
||||
End;
|
||||
|
||||
ProcessStatus ('Uploaded |15' + strI2S(FilesAdded) + ' |07file(s)');
|
||||
ProcessStatus ('Uploaded |15' + strI2S(FilesAdded) + ' |07file(s)', True);
|
||||
ProcessResult (rDONE, True);
|
||||
End;
|
||||
|
||||
|
|
Loading…
Reference in New Issue