Home » Personal collection » Acorn hard disk » apps » web » Telnet/!SysLog/!Help

Telnet/!SysLog/!Help

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn hard disk » apps » web
Filename: Telnet/!SysLog/!Help
Read OK:
File size: 5825 bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
============================================================================
SysLog Documentation
----------------------------------------------------------------------------
Version: 0.17
Author:  Jon Ribbens <jon@doggysoft.co.uk>

(c) DoggySoft Ltd., 1995, 1996, 1997

This program is Freeware and may be freely distributed so long as it is
not charged for, and none of the files are changed or removed. It may be
included with a commercial program which is charged for. There is no
warranty, express or implied. DoggySoft Ltd. is not liable for any loss
or damages caused by the use or misuse of this program.


Things done:
  * facility to insert arbitrary line
  * considered format of datestamp
  * implemented backoff system for errors writing to logs (partly a bugfix)
  * fixed bug which left files open on errors (e.g. disk full)
  * added Indent/UnIndent/NoIndent
  * do 'temporary logs' thingy for Termite session logs
  * implement log truncation at specified maximum size
  * read <SysLog$Dir> once and once only at startup
  * do automatic tidy-up of 'temporary logs'
  * fixed bug which corrupted the very last line in the options file
  * get allocation for SWI chunk and module name and OS commands
  * user options to disable session logs
  * added "*" line in options file to specify default values
  * reserve disk space option
  * make entry point use two-layer task, so RMEnsuring works
  * add *SysLog ON|OFF and *SysLog <log> <new priority>
  * LogData routine to log a block of hex data (e.g. IP packets)
  * add debugf routine for assembler people
  * add C front-end for C people
  * added SysLog_ReadErrorMessage
  * added %<reg>p and %<reg>a to LogFormatted
  * fixed order of %<reg>a (it was backwards)
  * made log buffer size dependent on logging level
  * made log buffer get de-allocated after ten minutes
  * added SysLog_LogComplete
  * made buffer size be recalculated when log level is changed
  * made setting log level also apply to session logs of that log
  * fixed tidying up of stray session logs (sometimes missed some)
  * fixed a few problems with sessions
0.15
  * termination of strings is now by zero-byte or line-feed
0.16
  * add log_forget and call it in CloseSessionLog
0.17
  * allow CR as a string terminator
  * automatically create 'Old' directory on startup
  * added 'IRQ mode'

To do:
  * add expression evaluation to LogFormatted
  * add optional checking of pointer validity
  * add 'features flags'

============================================================================
Rationale
----------------------------------------------------------------------------

Termite is currently lacking in logging facilities. In fact, most
communications software for the Arc is rather poor at logging. This module
is designed to make it easy for comprehensive logging to be added to any
RISC OS program.

The logging level can be altered by the user for individual log files, and
buffering is used to speed logging, so it is safe for programs to log large
quantities of data, provided that they use sensible priorities for each type
of message. The logs are also automatically kept to user-specified maximum
lengths, so there is no need to worry about filling up the user's hard disk.

Separate log files are used for each application, on the basis that such
segregation of information makes it much easier for the user to find what
they're looking for.

A back-off system is used for dealing with errors when writing to logs. Each
error is logged in the "SysLog" log, and the offending log is marked as
"dead". SysLog will then not attempt to write to that log again for one
second. If we again get an error writing to the log, we multiply the
"back-off" time by 1.5, and again mark the log as dead. The back-off time is
not allowed to grow longer than ten minutes.


============================================================================
Session logs
----------------------------------------------------------------------------

Usually, log entries are stored strictly chronologically. Sometimes, though,
it may be more useful to store them grouped by 'session'. For example,
NewsBite can have several incoming NNTP connections at once. It is nice to
group the log messages that are coming from each separate connection
together. This can be done using SysLog_OpenSessionLog.

SysLog_OpenSessionLog creates a specially-named temporary log file. The log
entries for the session are stored in this log file. When the temporary log
file is closed using SysLog_CloseSessionLog, this data is appended in one
chunk to the end of the main log.

SysLog checks for stray temporary log files when it initialises and
finalises, and appends them to the relevant logs. This copes with the
situation where an application crashes or otherwise exits without calling
SysLog_CloseSessionLog.


============================================================================
Priorities
----------------------------------------------------------------------------

Message priorities can be in the range 0 to 255, with 0 being the highest
priority and 255 being the lowest. Unless otherwise specified by the user,
only messages with priorities of less than 125 are stored in the log files.
You should therefore think about what things the user is likely to want to
have logged by default, and ensure that these things are logged at
a priority of 124 or less.

The priority of errors often depends on how significant the consequences of
the error are, not what the cause of it is. e.g. sometimes "out of memory"
will be an extremely important unrecoverable error (because the program
can't start up), and sometimes it will be unimportant (because the program
can use disk instead, or maybe try again later).


============================================================================
Log names
----------------------------------------------------------------------------

Log names are used as the leafnames to store the logs as, so they must
comply with the rules for RISC OS leafnames. They must also not be longer
than ten characters.

It is intended that each application have its own log, so an obvious choice
for the log name is the application name (without the '!'). Very large
applications could have more than one log file - in which case the naming
scheme is unspecified. Try and choose sensible log names.

If your application is going to be distributed, you should write to
support@doggysoft.co.uk, to request that your log name be formally
allocated. This will hopefully avoid having more than one program using the
same log file.

The following log names are reserved for internal use:

  any name beginning with a '-' character
  any name beginning with "SysLog"
  "Old"


============================================================================
OS commands
----------------------------------------------------------------------------

*SysLog <log name> <priority> <message>
 ------

Adds a time-stamped message to the log file, if and only if the specified
log file is set up to log messages of this priority. The priority must be in
the range 0-255.


*SysLog <log name> <new priority>
 ------

Temporarily (but with immediate effect) changes the logging priority of the
specified log. The priority must be in the range 0-256.


*SysLog ON|OFF
 ------

*SysLog OFF will temporary disable SysLog - all log messages received after
this command is issued will be ignored. *SysLog ON resumes normal operation.


*SysLog_Flush ON|OFF
 ------------

*SysLog_Flush with no paramaters flushes all currently open log files to
disk. If it used with the parameter 'ON' then it causes all log files to be
flushed immediately after each message is written to them. *SysLog_Flush OFF
disables this behaviour. (This is intended for use when the a program is
being debugged, and keeps crashing the computer. With SysLog_Flush ON,
you're guaranteed that all the log information your program produces before
it crashes will actually be available after a re-boot. It also makes logging
*very slow*.)


============================================================================
SWIs
----------------------------------------------------------------------------

SysLog_LogMessage (&4C880)
-----------------
R0-> log name, or = session log handle
R1-> text to log
R2 = priority

Adds a time-stamped message to the log file, if and only if the specified
log file is set up to log messages of this priority. The text to log must
not be longer than 1024 bytes. The priority must be in the range 0-255.


SysLog_GetLogLevel (&4C881)
------------------
R0-> log name, or = session log handle
exit:
R0 = priority

Reads the logging level for the specified log. Messages of *less than* the
returned priority are being logged. This can be used to avoid creation of
logging information that is only going to be discarded by SysLog_LogMessage
anyway. In some cases it could even be used to decide which version of
a program to load (e.g. whether to load a debugging version of TermiteIP).


SysLog_FlushLog (&4C882)
---------------
R0-> log name, or = session log handle, or = 0 to flush all logs

Ensures the specified log (or all logs) are fully written to disk, and the
files closed. This can be useful to make sure that the user is immediately
able to read data that has just been written to the log.


SysLog_SetLogLevel (&4C883)
------------------
R0-> log name, or = session log handle
R1 = new logging level

Sets the logging level for the specified log. This SWI is provided for
debugging and internal use only, and SHOULD NOT BE USED in distribution
code. The logging level is the user's decision, not the programmer's.


SysLog_LogUnstamped (&4C884)
-------------------
R0-> log name, or = session log handle
R1-> text to log
R2 = priority

Adds a message to the log file, if and only if the specified log file is set
to log messages of this priority. The text to log must not be longer than
1024 bytes. The priority must be in the range 0-255. It is recommended that
you use SysLog_LogMessage for all normal log entries.


SysLog_Indent (&4C885)
-------------
R0-> log name, or = session log handle

Increments the log indent level. In log lines generated by
SysLog_LogMessage, there are <indent_level + 1> spaces in between the
priority and the message. This can be useful to show the hierarchy of the
functions which are producing logging output. The indent level is initially
zero.


SysLog_UnIndent (&4C886)
---------------
R0-> log name, or = session log handle

Decrements the log indent level. (If it is zero it is not decremented.)


SysLog_NoIndent (&4C887)
---------------
R0-> log name, or = session log handle

Sets the log indent level to zero. This should be called when your program
loads, if you are using SysLog_Indent/UnIndent.


SysLog_OpenSessionLog (&4C888)
---------------------
R0-> log name
R1 = priority
exit:
R0 = session log handle (or 0)

Creates a temporary session log file. When the session log is closed (using
SysLog_CloseSessionLog, below), the session log is appended to the main log
as specified in R0 on entry to this SWI. If the main log is set to ignore
log entries of the priority specified then zero will be returned for the
session log handle. This does not necessarily require special case code, as
other SWIs which accept session log handles will accept a handle of zero and
do nothing.


SysLog_CloseSessionLog (&4C889)
----------------------
R0 = session log handle

Closes the specified temporary session log and appends it to the appropriate
main log file. The specified session log handle is no longer valid.


SysLog_LogData (&4C88A)
--------------
R0-> log name, or = session log handle
R1 = priority
R2-> data to log
R3 = number of bytes to log
R4 = value to report as block offset (-1 not to show block offset)

Logs a block of data, in a hex-and-ASCII format similar to that produced by
*Dump. The block offset is the value that is printed at the beginning of
each line, which is equal to the value given on entry plus the number of
bytes already displayed. If -1 is used as the block offset then the field
will be omitted. Note that if the number of bytes to log is over 10KB then
the SWI will return with an error - logging such a large amount of data in
one go is almost certainly a bug, so SysLog faults it to prevent the
computer going into a semi-infinite loop while it writes huge amounts of
data to disk.


SysLog_LogFormatted (&4C88B)
-------------------
R0-> log name, or = session log handle
R1-> format string
R2 = priority
R3-> block containing R0-R3,R8-R12,R14
R4-R7 = parameters

Evaluates a formatted string using registers R4-R7, and R0-R3, R8-R12 and
R14 from the block passed in R3, and logs the result. See the section
"LogFormatted", below.


SysLog_ReadErrorMessage (&4C88C)
-----------------------
R0 = error number
exit:
R0-> error message

Converts an error number as returned by the FreeNet/Internet/etc modules
into a string describing the error. e.g. SysLog_ReadErrorMessage 60 would
return "Connection timed out".


SysLog_LogComplete (&4C88D)
------------------
R0-> log name

Flushes the specified log, and de-allocates the buffer associated with it.
This should only be called if the log is definitely not going to be used for
a while (e.g. if your application is the only one which can be writing to
the log, and it's exiting). If this isn't called explicity, SysLog
automatically de-allocates the log buffer after ten minutes of inactivity in
the log.


SysLog_IRQMode (&4C88E)
--------------
R0 = 0 to disable IRQ mode, 1 to enable IRQ mode

Enables or disables IRQ mode. See the section "IRQ Mode", below.


============================================================================
IRQ Mode
----------------------------------------------------------------------------

If IRQ mode is enabled, you may call SysLog_LogMessage, SysLog_LogUnstamped,
SysLog_LogData and SysLog_LogFormatted from within interrupt code. Normally
you would not expect to be able to call these SWIs in this situation because
the filing system might be threaded.

In IRQ mode, the buffers are not flushed if they become full, so you are
guaranteed to be able to call the SWIs without Bad Things happening (all
they will be doing is writing to memory). If the buffers are full, however,
then log messages will be lost.

If log messages are lost due to the buffers becoming full then a line to
this effect will be added to the log at the next opportunity.

Do try to ensure that you call SysLog_IRQMode to disable IRQ mode when
you are exiting the interrupt code, otherwise other applications may have
their log messages lost unnecessarily. SysLog maintains a counter of how
man times IRQ mode has been enabled and disabled, and only genuinely
disables it when the counter is zero.

SysLog_GetLogLevel, SysLog_Indent, SysLog_UnIndent, SysLog_NoIndent and
SysLog_ReadErrorMessage may always be called from interrupt code. Other
SysLog SWIs may never be called from interrupt code.


============================================================================
LogFormatted
----------------------------------------------------------------------------

SWI SysLog_LogFormatted provides C "printf"-style functionality for
assembler programmers. A format string is passed in R1, which is a template
for the output. The string is copied directly to the output, except for '%'
characters, which inserts a string calculated when the SWI is called:

        %%      - the literal '%' character
        %<reg>a - the network-byte-ordered IP address in register <reg>
        %<reg>c - the character in register <reg>
        %<reg>d - the signed decimal integer in register <reg>
        %<reg>e - the message for the FreeNet error number in register <reg>
        %<reg>f - the filename of the file handle in register <reg>
        %<reg>p - the object pointed to by register <reg>
        %<reg>s - the control-terminated string pointed to by register <reg>
        %<reg>x - the unsigned hexadecimal integer in register <reg>
        %<reg>z - the zero-terminated string pointed to by register <reg>

   where <reg> is a number which can be any of 0 to 12 or 14.

Note that the %<reg>p type must be followed by another type indicator. For
example, to log a character pointed to by register R3, use "%3pc". More than
one 'p' can be used to indicate more than one level of indirection.

Null pointers are explicitly checked for wherever used, and the string
"(null)" is logged in place of whatever should have been output. Hence it
is explicity defined that it is safe to allow null pointers to be in
registers used by the format string.

Registers R4-R7 are taken directly from the registers passed to the SWI.
Registers R0-R3, R8-R12 and R14 are taken from the block passed in R3.

It is expected that this SWI would be packaged in a macro in your assembler
source code. For example:

...
.stricmp
  FNlogf("stricmp: comparing %0z and %1z",200)
...

DEF FNlogf(t$,p%)
  [OPT p
    STMFD   R13!,{R0-R3,R8-R12,R14}
    ADR     R0,txt_logname
    ADD     R1,R15,#12
    MOV     R2,#p%
    MOV     R3,R13
    SWI     "SysLog_LogFormatted"
    B       P%+(LENt$+8)ANDNOT3
    EQUS    t$+STRING$(4-(LENt$AND3),CHR$0)
    LDMFD   R13!,{R0-R3,R8-R12,R14}
  ]
=p

or the ObjAsm equivalent:

        MACRO
        LOGF    $t,$p

        STMFD   R13!,{R0-R3,R8-R12,R14}
        ADR     R0,txt_logname
        ADR     R1,%ft90
        MOV     R2,#$p
        MOV     R3,R13
        SWI     SysLog_LogFormatted
        B       %ft91
90
        =       "$t",0
        ALIGN
91      LDMFD   R13!,{R0-R3,R8-R12,R14}
        MEND

...
stricmp ROUT
        LOGF    "stricmp: comparing %0z and %1z",200
...


============================================================================
Using SysLog from C programs
----------------------------------------------------------------------------

To make SysLog easy to use from C programs, I have written an APCS veneer
for the module. This takes the form of a "syslog.h" header file which you
should #include from your C source, and a "syslog.o" object file which you
should link your program with.

There are two calls for each SWI, one which uses the non-X form and one
which uses the X form and returns a _kernel_oserror *. The non-X forms are
generally nicer as values can be returned in the usual manner, rather than
having to pass a pointer to a location to be filled in with the return code.
I would suggest only using the X forms when you absolutely must - i.e. in
module code, etc.

There's also a bonus function "syslogf" (and "xsyslogf") which is like
"printf" except it outputs to the log. The first two arguments are the
logname and priority, and the rest are the usual printf arguments (i.e.
the format string followed by a variable number of arguments).

Note that a temporary buffer is used to hold the string before it is passed
to the SysLog module and *THIS BUFFER IS ONLY 1024 BYTES LONG*. i.e. you
must ensure that your format string cannot ever produce more than 1024 bytes
of output. This is especially important in networking software where the
input may be coming from a Bad Miscreant who is trying to hack into or crash
your machine.

The ObjAsm source to the veneer object file is provided. If you make any
changes which you think people might find useful, or you find any bugs,
please e-mail me and tell me about it.

Thanks go to Stewart Brodie for assistance with vsprintf ;-).


============================================================================
Options
----------------------------------------------------------------------------

The options file is stored as !SysLog.Options. Each line of the options file
specifies the options for a single log. This line is of the format:
    <logname> [Reserve <size>|NoReserve] [Sessions|NoSessions]
              [<level> [<max. size>]]
<size> and <max. size> are specified in kilobytes.

An entry for log "*" is treated as the default values, which are used if
the log doesn't have a specific entry in the Options file. So, for example,
to specify "NoSessions" for every log except "NewsBite" you could use:
  * NoSessions
  NewsBite Sessions

The options have the following meanings:

  Reserve <size>
    SysLog will make sure that at least <size> KB of disk space is free for
    this log, by padding the log file with zeros which are later overwritten
    by the real log data.
  NoReserve
    SysLog won't reserve disk space for this log as described above. This is
    the default.

  Sessions
    SysLog will use Session Logs for this log (as described above) where
    instructed. This is the default.
  NoSessions
    Session Logs are disabled for this log, and log entries will appear
    strictly in chronological order.

  <level>
    SysLog will ignore log entries for this log which have a priority
    greater to or equal than this value. The default value is 125.

  <max. size>
    The log will be moved to the "Old" directory when it becomes larger
    than this size. The default value is 256KB.


============================================================================
Usage guidelines
----------------------------------------------------------------------------

Previously in this section I recommended that programs should not fail to
work if logging is not available. This is reasonable - however there are
very few reasons that logging will fail, and all of these reasons are very
likely to cause the main function of the program to fail. I would suggest
therefore that programs should RMEnsure the SysLog module in their !Run
files, and then use it as any other SWI.

Errors from SysLog SWIs, while strictly speaking non-fatal for the main
program, are indicative of something being badly wrong with the system. Use
'X' SWIs in situations such as modules where you have to, of course, but in
application code where you have an error handler, you might as well use the
non-'X' form and treat the errors as you would any other.

Programs which use SysLog should RMEnsure it in their !Run files. The
suggested lines to use are as follows:

If "<SysLog$Dir>"="" then Error !SysLog application not seen by filer
RMEnsure SysLog 0.17 Run <SysLog$Dir>.!Run
RMEnsure SysLog 0.17 Error MyApp needs SysLog 0.17 or later

Note that you must *not* just RMLoad the SysLog module, as it requires its
Wimp task to be activated, and this will not happen if you just RMLoad the
module. The module has a two-stage application entry point, so it will
return immediately when you RMRun it, allowing the !Run file to continue as
normal.
00000000  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00000040  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 0a 53 79 73  |============.Sys|
00000050  4c 6f 67 20 44 6f 63 75  6d 65 6e 74 61 74 69 6f  |Log Documentatio|
00000060  6e 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |n.--------------|
00000070  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000000a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 56  |--------------.V|
000000b0  65 72 73 69 6f 6e 3a 20  30 2e 31 37 0a 41 75 74  |ersion: 0.17.Aut|
000000c0  68 6f 72 3a 20 20 4a 6f  6e 20 52 69 62 62 65 6e  |hor:  Jon Ribben|
000000d0  73 20 3c 6a 6f 6e 40 64  6f 67 67 79 73 6f 66 74  |s <jon@doggysoft|
000000e0  2e 63 6f 2e 75 6b 3e 0a  0a 28 63 29 20 44 6f 67  |.co.uk>..(c) Dog|
000000f0  67 79 53 6f 66 74 20 4c  74 64 2e 2c 20 31 39 39  |gySoft Ltd., 199|
00000100  35 2c 20 31 39 39 36 2c  20 31 39 39 37 0a 0a 54  |5, 1996, 1997..T|
00000110  68 69 73 20 70 72 6f 67  72 61 6d 20 69 73 20 46  |his program is F|
00000120  72 65 65 77 61 72 65 20  61 6e 64 20 6d 61 79 20  |reeware and may |
00000130  62 65 20 66 72 65 65 6c  79 20 64 69 73 74 72 69  |be freely distri|
00000140  62 75 74 65 64 20 73 6f  20 6c 6f 6e 67 20 61 73  |buted so long as|
00000150  20 69 74 20 69 73 0a 6e  6f 74 20 63 68 61 72 67  | it is.not charg|
00000160  65 64 20 66 6f 72 2c 20  61 6e 64 20 6e 6f 6e 65  |ed for, and none|
00000170  20 6f 66 20 74 68 65 20  66 69 6c 65 73 20 61 72  | of the files ar|
00000180  65 20 63 68 61 6e 67 65  64 20 6f 72 20 72 65 6d  |e changed or rem|
00000190  6f 76 65 64 2e 20 49 74  20 6d 61 79 20 62 65 0a  |oved. It may be.|
000001a0  69 6e 63 6c 75 64 65 64  20 77 69 74 68 20 61 20  |included with a |
000001b0  63 6f 6d 6d 65 72 63 69  61 6c 20 70 72 6f 67 72  |commercial progr|
000001c0  61 6d 20 77 68 69 63 68  20 69 73 20 63 68 61 72  |am which is char|
000001d0  67 65 64 20 66 6f 72 2e  20 54 68 65 72 65 20 69  |ged for. There i|
000001e0  73 20 6e 6f 0a 77 61 72  72 61 6e 74 79 2c 20 65  |s no.warranty, e|
000001f0  78 70 72 65 73 73 20 6f  72 20 69 6d 70 6c 69 65  |xpress or implie|
00000200  64 2e 20 44 6f 67 67 79  53 6f 66 74 20 4c 74 64  |d. DoggySoft Ltd|
00000210  2e 20 69 73 20 6e 6f 74  20 6c 69 61 62 6c 65 20  |. is not liable |
00000220  66 6f 72 20 61 6e 79 20  6c 6f 73 73 0a 6f 72 20  |for any loss.or |
00000230  64 61 6d 61 67 65 73 20  63 61 75 73 65 64 20 62  |damages caused b|
00000240  79 20 74 68 65 20 75 73  65 20 6f 72 20 6d 69 73  |y the use or mis|
00000250  75 73 65 20 6f 66 20 74  68 69 73 20 70 72 6f 67  |use of this prog|
00000260  72 61 6d 2e 0a 0a 0a 54  68 69 6e 67 73 20 64 6f  |ram....Things do|
00000270  6e 65 3a 0a 20 20 2a 20  66 61 63 69 6c 69 74 79  |ne:.  * facility|
00000280  20 74 6f 20 69 6e 73 65  72 74 20 61 72 62 69 74  | to insert arbit|
00000290  72 61 72 79 20 6c 69 6e  65 0a 20 20 2a 20 63 6f  |rary line.  * co|
000002a0  6e 73 69 64 65 72 65 64  20 66 6f 72 6d 61 74 20  |nsidered format |
000002b0  6f 66 20 64 61 74 65 73  74 61 6d 70 0a 20 20 2a  |of datestamp.  *|
000002c0  20 69 6d 70 6c 65 6d 65  6e 74 65 64 20 62 61 63  | implemented bac|
000002d0  6b 6f 66 66 20 73 79 73  74 65 6d 20 66 6f 72 20  |koff system for |
000002e0  65 72 72 6f 72 73 20 77  72 69 74 69 6e 67 20 74  |errors writing t|
000002f0  6f 20 6c 6f 67 73 20 28  70 61 72 74 6c 79 20 61  |o logs (partly a|
00000300  20 62 75 67 66 69 78 29  0a 20 20 2a 20 66 69 78  | bugfix).  * fix|
00000310  65 64 20 62 75 67 20 77  68 69 63 68 20 6c 65 66  |ed bug which lef|
00000320  74 20 66 69 6c 65 73 20  6f 70 65 6e 20 6f 6e 20  |t files open on |
00000330  65 72 72 6f 72 73 20 28  65 2e 67 2e 20 64 69 73  |errors (e.g. dis|
00000340  6b 20 66 75 6c 6c 29 0a  20 20 2a 20 61 64 64 65  |k full).  * adde|
00000350  64 20 49 6e 64 65 6e 74  2f 55 6e 49 6e 64 65 6e  |d Indent/UnInden|
00000360  74 2f 4e 6f 49 6e 64 65  6e 74 0a 20 20 2a 20 64  |t/NoIndent.  * d|
00000370  6f 20 27 74 65 6d 70 6f  72 61 72 79 20 6c 6f 67  |o 'temporary log|
00000380  73 27 20 74 68 69 6e 67  79 20 66 6f 72 20 54 65  |s' thingy for Te|
00000390  72 6d 69 74 65 20 73 65  73 73 69 6f 6e 20 6c 6f  |rmite session lo|
000003a0  67 73 0a 20 20 2a 20 69  6d 70 6c 65 6d 65 6e 74  |gs.  * implement|
000003b0  20 6c 6f 67 20 74 72 75  6e 63 61 74 69 6f 6e 20  | log truncation |
000003c0  61 74 20 73 70 65 63 69  66 69 65 64 20 6d 61 78  |at specified max|
000003d0  69 6d 75 6d 20 73 69 7a  65 0a 20 20 2a 20 72 65  |imum size.  * re|
000003e0  61 64 20 3c 53 79 73 4c  6f 67 24 44 69 72 3e 20  |ad <SysLog$Dir> |
000003f0  6f 6e 63 65 20 61 6e 64  20 6f 6e 63 65 20 6f 6e  |once and once on|
00000400  6c 79 20 61 74 20 73 74  61 72 74 75 70 0a 20 20  |ly at startup.  |
00000410  2a 20 64 6f 20 61 75 74  6f 6d 61 74 69 63 20 74  |* do automatic t|
00000420  69 64 79 2d 75 70 20 6f  66 20 27 74 65 6d 70 6f  |idy-up of 'tempo|
00000430  72 61 72 79 20 6c 6f 67  73 27 0a 20 20 2a 20 66  |rary logs'.  * f|
00000440  69 78 65 64 20 62 75 67  20 77 68 69 63 68 20 63  |ixed bug which c|
00000450  6f 72 72 75 70 74 65 64  20 74 68 65 20 76 65 72  |orrupted the ver|
00000460  79 20 6c 61 73 74 20 6c  69 6e 65 20 69 6e 20 74  |y last line in t|
00000470  68 65 20 6f 70 74 69 6f  6e 73 20 66 69 6c 65 0a  |he options file.|
00000480  20 20 2a 20 67 65 74 20  61 6c 6c 6f 63 61 74 69  |  * get allocati|
00000490  6f 6e 20 66 6f 72 20 53  57 49 20 63 68 75 6e 6b  |on for SWI chunk|
000004a0  20 61 6e 64 20 6d 6f 64  75 6c 65 20 6e 61 6d 65  | and module name|
000004b0  20 61 6e 64 20 4f 53 20  63 6f 6d 6d 61 6e 64 73  | and OS commands|
000004c0  0a 20 20 2a 20 75 73 65  72 20 6f 70 74 69 6f 6e  |.  * user option|
000004d0  73 20 74 6f 20 64 69 73  61 62 6c 65 20 73 65 73  |s to disable ses|
000004e0  73 69 6f 6e 20 6c 6f 67  73 0a 20 20 2a 20 61 64  |sion logs.  * ad|
000004f0  64 65 64 20 22 2a 22 20  6c 69 6e 65 20 69 6e 20  |ded "*" line in |
00000500  6f 70 74 69 6f 6e 73 20  66 69 6c 65 20 74 6f 20  |options file to |
00000510  73 70 65 63 69 66 79 20  64 65 66 61 75 6c 74 20  |specify default |
00000520  76 61 6c 75 65 73 0a 20  20 2a 20 72 65 73 65 72  |values.  * reser|
00000530  76 65 20 64 69 73 6b 20  73 70 61 63 65 20 6f 70  |ve disk space op|
00000540  74 69 6f 6e 0a 20 20 2a  20 6d 61 6b 65 20 65 6e  |tion.  * make en|
00000550  74 72 79 20 70 6f 69 6e  74 20 75 73 65 20 74 77  |try point use tw|
00000560  6f 2d 6c 61 79 65 72 20  74 61 73 6b 2c 20 73 6f  |o-layer task, so|
00000570  20 52 4d 45 6e 73 75 72  69 6e 67 20 77 6f 72 6b  | RMEnsuring work|
00000580  73 0a 20 20 2a 20 61 64  64 20 2a 53 79 73 4c 6f  |s.  * add *SysLo|
00000590  67 20 4f 4e 7c 4f 46 46  20 61 6e 64 20 2a 53 79  |g ON|OFF and *Sy|
000005a0  73 4c 6f 67 20 3c 6c 6f  67 3e 20 3c 6e 65 77 20  |sLog <log> <new |
000005b0  70 72 69 6f 72 69 74 79  3e 0a 20 20 2a 20 4c 6f  |priority>.  * Lo|
000005c0  67 44 61 74 61 20 72 6f  75 74 69 6e 65 20 74 6f  |gData routine to|
000005d0  20 6c 6f 67 20 61 20 62  6c 6f 63 6b 20 6f 66 20  | log a block of |
000005e0  68 65 78 20 64 61 74 61  20 28 65 2e 67 2e 20 49  |hex data (e.g. I|
000005f0  50 20 70 61 63 6b 65 74  73 29 0a 20 20 2a 20 61  |P packets).  * a|
00000600  64 64 20 64 65 62 75 67  66 20 72 6f 75 74 69 6e  |dd debugf routin|
00000610  65 20 66 6f 72 20 61 73  73 65 6d 62 6c 65 72 20  |e for assembler |
00000620  70 65 6f 70 6c 65 0a 20  20 2a 20 61 64 64 20 43  |people.  * add C|
00000630  20 66 72 6f 6e 74 2d 65  6e 64 20 66 6f 72 20 43  | front-end for C|
00000640  20 70 65 6f 70 6c 65 0a  20 20 2a 20 61 64 64 65  | people.  * adde|
00000650  64 20 53 79 73 4c 6f 67  5f 52 65 61 64 45 72 72  |d SysLog_ReadErr|
00000660  6f 72 4d 65 73 73 61 67  65 0a 20 20 2a 20 61 64  |orMessage.  * ad|
00000670  64 65 64 20 25 3c 72 65  67 3e 70 20 61 6e 64 20  |ded %<reg>p and |
00000680  25 3c 72 65 67 3e 61 20  74 6f 20 4c 6f 67 46 6f  |%<reg>a to LogFo|
00000690  72 6d 61 74 74 65 64 0a  20 20 2a 20 66 69 78 65  |rmatted.  * fixe|
000006a0  64 20 6f 72 64 65 72 20  6f 66 20 25 3c 72 65 67  |d order of %<reg|
000006b0  3e 61 20 28 69 74 20 77  61 73 20 62 61 63 6b 77  |>a (it was backw|
000006c0  61 72 64 73 29 0a 20 20  2a 20 6d 61 64 65 20 6c  |ards).  * made l|
000006d0  6f 67 20 62 75 66 66 65  72 20 73 69 7a 65 20 64  |og buffer size d|
000006e0  65 70 65 6e 64 65 6e 74  20 6f 6e 20 6c 6f 67 67  |ependent on logg|
000006f0  69 6e 67 20 6c 65 76 65  6c 0a 20 20 2a 20 6d 61  |ing level.  * ma|
00000700  64 65 20 6c 6f 67 20 62  75 66 66 65 72 20 67 65  |de log buffer ge|
00000710  74 20 64 65 2d 61 6c 6c  6f 63 61 74 65 64 20 61  |t de-allocated a|
00000720  66 74 65 72 20 74 65 6e  20 6d 69 6e 75 74 65 73  |fter ten minutes|
00000730  0a 20 20 2a 20 61 64 64  65 64 20 53 79 73 4c 6f  |.  * added SysLo|
00000740  67 5f 4c 6f 67 43 6f 6d  70 6c 65 74 65 0a 20 20  |g_LogComplete.  |
00000750  2a 20 6d 61 64 65 20 62  75 66 66 65 72 20 73 69  |* made buffer si|
00000760  7a 65 20 62 65 20 72 65  63 61 6c 63 75 6c 61 74  |ze be recalculat|
00000770  65 64 20 77 68 65 6e 20  6c 6f 67 20 6c 65 76 65  |ed when log leve|
00000780  6c 20 69 73 20 63 68 61  6e 67 65 64 0a 20 20 2a  |l is changed.  *|
00000790  20 6d 61 64 65 20 73 65  74 74 69 6e 67 20 6c 6f  | made setting lo|
000007a0  67 20 6c 65 76 65 6c 20  61 6c 73 6f 20 61 70 70  |g level also app|
000007b0  6c 79 20 74 6f 20 73 65  73 73 69 6f 6e 20 6c 6f  |ly to session lo|
000007c0  67 73 20 6f 66 20 74 68  61 74 20 6c 6f 67 0a 20  |gs of that log. |
000007d0  20 2a 20 66 69 78 65 64  20 74 69 64 79 69 6e 67  | * fixed tidying|
000007e0  20 75 70 20 6f 66 20 73  74 72 61 79 20 73 65 73  | up of stray ses|
000007f0  73 69 6f 6e 20 6c 6f 67  73 20 28 73 6f 6d 65 74  |sion logs (somet|
00000800  69 6d 65 73 20 6d 69 73  73 65 64 20 73 6f 6d 65  |imes missed some|
00000810  29 0a 20 20 2a 20 66 69  78 65 64 20 61 20 66 65  |).  * fixed a fe|
00000820  77 20 70 72 6f 62 6c 65  6d 73 20 77 69 74 68 20  |w problems with |
00000830  73 65 73 73 69 6f 6e 73  0a 30 2e 31 35 0a 20 20  |sessions.0.15.  |
00000840  2a 20 74 65 72 6d 69 6e  61 74 69 6f 6e 20 6f 66  |* termination of|
00000850  20 73 74 72 69 6e 67 73  20 69 73 20 6e 6f 77 20  | strings is now |
00000860  62 79 20 7a 65 72 6f 2d  62 79 74 65 20 6f 72 20  |by zero-byte or |
00000870  6c 69 6e 65 2d 66 65 65  64 0a 30 2e 31 36 0a 20  |line-feed.0.16. |
00000880  20 2a 20 61 64 64 20 6c  6f 67 5f 66 6f 72 67 65  | * add log_forge|
00000890  74 20 61 6e 64 20 63 61  6c 6c 20 69 74 20 69 6e  |t and call it in|
000008a0  20 43 6c 6f 73 65 53 65  73 73 69 6f 6e 4c 6f 67  | CloseSessionLog|
000008b0  0a 30 2e 31 37 0a 20 20  2a 20 61 6c 6c 6f 77 20  |.0.17.  * allow |
000008c0  43 52 20 61 73 20 61 20  73 74 72 69 6e 67 20 74  |CR as a string t|
000008d0  65 72 6d 69 6e 61 74 6f  72 0a 20 20 2a 20 61 75  |erminator.  * au|
000008e0  74 6f 6d 61 74 69 63 61  6c 6c 79 20 63 72 65 61  |tomatically crea|
000008f0  74 65 20 27 4f 6c 64 27  20 64 69 72 65 63 74 6f  |te 'Old' directo|
00000900  72 79 20 6f 6e 20 73 74  61 72 74 75 70 0a 20 20  |ry on startup.  |
00000910  2a 20 61 64 64 65 64 20  27 49 52 51 20 6d 6f 64  |* added 'IRQ mod|
00000920  65 27 0a 0a 54 6f 20 64  6f 3a 0a 20 20 2a 20 61  |e'..To do:.  * a|
00000930  64 64 20 65 78 70 72 65  73 73 69 6f 6e 20 65 76  |dd expression ev|
00000940  61 6c 75 61 74 69 6f 6e  20 74 6f 20 4c 6f 67 46  |aluation to LogF|
00000950  6f 72 6d 61 74 74 65 64  0a 20 20 2a 20 61 64 64  |ormatted.  * add|
00000960  20 6f 70 74 69 6f 6e 61  6c 20 63 68 65 63 6b 69  | optional checki|
00000970  6e 67 20 6f 66 20 70 6f  69 6e 74 65 72 20 76 61  |ng of pointer va|
00000980  6c 69 64 69 74 79 0a 20  20 2a 20 61 64 64 20 27  |lidity.  * add '|
00000990  66 65 61 74 75 72 65 73  20 66 6c 61 67 73 27 0a  |features flags'.|
000009a0  0a 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.===============|
000009b0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000009e0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 0a 52 61  |=============.Ra|
000009f0  74 69 6f 6e 61 6c 65 0a  2d 2d 2d 2d 2d 2d 2d 2d  |tionale.--------|
00000a00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000a40  2d 2d 2d 2d 0a 0a 54 65  72 6d 69 74 65 20 69 73  |----..Termite is|
00000a50  20 63 75 72 72 65 6e 74  6c 79 20 6c 61 63 6b 69  | currently lacki|
00000a60  6e 67 20 69 6e 20 6c 6f  67 67 69 6e 67 20 66 61  |ng in logging fa|
00000a70  63 69 6c 69 74 69 65 73  2e 20 49 6e 20 66 61 63  |cilities. In fac|
00000a80  74 2c 20 6d 6f 73 74 0a  63 6f 6d 6d 75 6e 69 63  |t, most.communic|
00000a90  61 74 69 6f 6e 73 20 73  6f 66 74 77 61 72 65 20  |ations software |
00000aa0  66 6f 72 20 74 68 65 20  41 72 63 20 69 73 20 72  |for the Arc is r|
00000ab0  61 74 68 65 72 20 70 6f  6f 72 20 61 74 20 6c 6f  |ather poor at lo|
00000ac0  67 67 69 6e 67 2e 20 54  68 69 73 20 6d 6f 64 75  |gging. This modu|
00000ad0  6c 65 0a 69 73 20 64 65  73 69 67 6e 65 64 20 74  |le.is designed t|
00000ae0  6f 20 6d 61 6b 65 20 69  74 20 65 61 73 79 20 66  |o make it easy f|
00000af0  6f 72 20 63 6f 6d 70 72  65 68 65 6e 73 69 76 65  |or comprehensive|
00000b00  20 6c 6f 67 67 69 6e 67  20 74 6f 20 62 65 20 61  | logging to be a|
00000b10  64 64 65 64 20 74 6f 20  61 6e 79 0a 52 49 53 43  |dded to any.RISC|
00000b20  20 4f 53 20 70 72 6f 67  72 61 6d 2e 0a 0a 54 68  | OS program...Th|
00000b30  65 20 6c 6f 67 67 69 6e  67 20 6c 65 76 65 6c 20  |e logging level |
00000b40  63 61 6e 20 62 65 20 61  6c 74 65 72 65 64 20 62  |can be altered b|
00000b50  79 20 74 68 65 20 75 73  65 72 20 66 6f 72 20 69  |y the user for i|
00000b60  6e 64 69 76 69 64 75 61  6c 20 6c 6f 67 20 66 69  |ndividual log fi|
00000b70  6c 65 73 2c 20 61 6e 64  0a 62 75 66 66 65 72 69  |les, and.bufferi|
00000b80  6e 67 20 69 73 20 75 73  65 64 20 74 6f 20 73 70  |ng is used to sp|
00000b90  65 65 64 20 6c 6f 67 67  69 6e 67 2c 20 73 6f 20  |eed logging, so |
00000ba0  69 74 20 69 73 20 73 61  66 65 20 66 6f 72 20 70  |it is safe for p|
00000bb0  72 6f 67 72 61 6d 73 20  74 6f 20 6c 6f 67 20 6c  |rograms to log l|
00000bc0  61 72 67 65 0a 71 75 61  6e 74 69 74 69 65 73 20  |arge.quantities |
00000bd0  6f 66 20 64 61 74 61 2c  20 70 72 6f 76 69 64 65  |of data, provide|
00000be0  64 20 74 68 61 74 20 74  68 65 79 20 75 73 65 20  |d that they use |
00000bf0  73 65 6e 73 69 62 6c 65  20 70 72 69 6f 72 69 74  |sensible priorit|
00000c00  69 65 73 20 66 6f 72 20  65 61 63 68 20 74 79 70  |ies for each typ|
00000c10  65 0a 6f 66 20 6d 65 73  73 61 67 65 2e 20 54 68  |e.of message. Th|
00000c20  65 20 6c 6f 67 73 20 61  72 65 20 61 6c 73 6f 20  |e logs are also |
00000c30  61 75 74 6f 6d 61 74 69  63 61 6c 6c 79 20 6b 65  |automatically ke|
00000c40  70 74 20 74 6f 20 75 73  65 72 2d 73 70 65 63 69  |pt to user-speci|
00000c50  66 69 65 64 20 6d 61 78  69 6d 75 6d 0a 6c 65 6e  |fied maximum.len|
00000c60  67 74 68 73 2c 20 73 6f  20 74 68 65 72 65 20 69  |gths, so there i|
00000c70  73 20 6e 6f 20 6e 65 65  64 20 74 6f 20 77 6f 72  |s no need to wor|
00000c80  72 79 20 61 62 6f 75 74  20 66 69 6c 6c 69 6e 67  |ry about filling|
00000c90  20 75 70 20 74 68 65 20  75 73 65 72 27 73 20 68  | up the user's h|
00000ca0  61 72 64 20 64 69 73 6b  2e 0a 0a 53 65 70 61 72  |ard disk...Separ|
00000cb0  61 74 65 20 6c 6f 67 20  66 69 6c 65 73 20 61 72  |ate log files ar|
00000cc0  65 20 75 73 65 64 20 66  6f 72 20 65 61 63 68 20  |e used for each |
00000cd0  61 70 70 6c 69 63 61 74  69 6f 6e 2c 20 6f 6e 20  |application, on |
00000ce0  74 68 65 20 62 61 73 69  73 20 74 68 61 74 20 73  |the basis that s|
00000cf0  75 63 68 0a 73 65 67 72  65 67 61 74 69 6f 6e 20  |uch.segregation |
00000d00  6f 66 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 6d  |of information m|
00000d10  61 6b 65 73 20 69 74 20  6d 75 63 68 20 65 61 73  |akes it much eas|
00000d20  69 65 72 20 66 6f 72 20  74 68 65 20 75 73 65 72  |ier for the user|
00000d30  20 74 6f 20 66 69 6e 64  20 77 68 61 74 0a 74 68  | to find what.th|
00000d40  65 79 27 72 65 20 6c 6f  6f 6b 69 6e 67 20 66 6f  |ey're looking fo|
00000d50  72 2e 0a 0a 41 20 62 61  63 6b 2d 6f 66 66 20 73  |r...A back-off s|
00000d60  79 73 74 65 6d 20 69 73  20 75 73 65 64 20 66 6f  |ystem is used fo|
00000d70  72 20 64 65 61 6c 69 6e  67 20 77 69 74 68 20 65  |r dealing with e|
00000d80  72 72 6f 72 73 20 77 68  65 6e 20 77 72 69 74 69  |rrors when writi|
00000d90  6e 67 20 74 6f 20 6c 6f  67 73 2e 20 45 61 63 68  |ng to logs. Each|
00000da0  0a 65 72 72 6f 72 20 69  73 20 6c 6f 67 67 65 64  |.error is logged|
00000db0  20 69 6e 20 74 68 65 20  22 53 79 73 4c 6f 67 22  | in the "SysLog"|
00000dc0  20 6c 6f 67 2c 20 61 6e  64 20 74 68 65 20 6f 66  | log, and the of|
00000dd0  66 65 6e 64 69 6e 67 20  6c 6f 67 20 69 73 20 6d  |fending log is m|
00000de0  61 72 6b 65 64 20 61 73  0a 22 64 65 61 64 22 2e  |arked as."dead".|
00000df0  20 53 79 73 4c 6f 67 20  77 69 6c 6c 20 74 68 65  | SysLog will the|
00000e00  6e 20 6e 6f 74 20 61 74  74 65 6d 70 74 20 74 6f  |n not attempt to|
00000e10  20 77 72 69 74 65 20 74  6f 20 74 68 61 74 20 6c  | write to that l|
00000e20  6f 67 20 61 67 61 69 6e  20 66 6f 72 20 6f 6e 65  |og again for one|
00000e30  0a 73 65 63 6f 6e 64 2e  20 49 66 20 77 65 20 61  |.second. If we a|
00000e40  67 61 69 6e 20 67 65 74  20 61 6e 20 65 72 72 6f  |gain get an erro|
00000e50  72 20 77 72 69 74 69 6e  67 20 74 6f 20 74 68 65  |r writing to the|
00000e60  20 6c 6f 67 2c 20 77 65  20 6d 75 6c 74 69 70 6c  | log, we multipl|
00000e70  79 20 74 68 65 0a 22 62  61 63 6b 2d 6f 66 66 22  |y the."back-off"|
00000e80  20 74 69 6d 65 20 62 79  20 31 2e 35 2c 20 61 6e  | time by 1.5, an|
00000e90  64 20 61 67 61 69 6e 20  6d 61 72 6b 20 74 68 65  |d again mark the|
00000ea0  20 6c 6f 67 20 61 73 20  64 65 61 64 2e 20 54 68  | log as dead. Th|
00000eb0  65 20 62 61 63 6b 2d 6f  66 66 20 74 69 6d 65 20  |e back-off time |
00000ec0  69 73 0a 6e 6f 74 20 61  6c 6c 6f 77 65 64 20 74  |is.not allowed t|
00000ed0  6f 20 67 72 6f 77 20 6c  6f 6e 67 65 72 20 74 68  |o grow longer th|
00000ee0  61 6e 20 74 65 6e 20 6d  69 6e 75 74 65 73 2e 0a  |an ten minutes..|
00000ef0  0a 0a 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |..==============|
00000f00  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00000f30  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 0a 53  |==============.S|
00000f40  65 73 73 69 6f 6e 20 6c  6f 67 73 0a 2d 2d 2d 2d  |ession logs.----|
00000f50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000f90  2d 2d 2d 2d 2d 2d 2d 2d  0a 0a 55 73 75 61 6c 6c  |--------..Usuall|
00000fa0  79 2c 20 6c 6f 67 20 65  6e 74 72 69 65 73 20 61  |y, log entries a|
00000fb0  72 65 20 73 74 6f 72 65  64 20 73 74 72 69 63 74  |re stored strict|
00000fc0  6c 79 20 63 68 72 6f 6e  6f 6c 6f 67 69 63 61 6c  |ly chronological|
00000fd0  6c 79 2e 20 53 6f 6d 65  74 69 6d 65 73 2c 20 74  |ly. Sometimes, t|
00000fe0  68 6f 75 67 68 2c 0a 69  74 20 6d 61 79 20 62 65  |hough,.it may be|
00000ff0  20 6d 6f 72 65 20 75 73  65 66 75 6c 20 74 6f 20  | more useful to |
00001000  73 74 6f 72 65 20 74 68  65 6d 20 67 72 6f 75 70  |store them group|
00001010  65 64 20 62 79 20 27 73  65 73 73 69 6f 6e 27 2e  |ed by 'session'.|
00001020  20 46 6f 72 20 65 78 61  6d 70 6c 65 2c 0a 4e 65  | For example,.Ne|
00001030  77 73 42 69 74 65 20 63  61 6e 20 68 61 76 65 20  |wsBite can have |
00001040  73 65 76 65 72 61 6c 20  69 6e 63 6f 6d 69 6e 67  |several incoming|
00001050  20 4e 4e 54 50 20 63 6f  6e 6e 65 63 74 69 6f 6e  | NNTP connection|
00001060  73 20 61 74 20 6f 6e 63  65 2e 20 49 74 20 69 73  |s at once. It is|
00001070  20 6e 69 63 65 20 74 6f  0a 67 72 6f 75 70 20 74  | nice to.group t|
00001080  68 65 20 6c 6f 67 20 6d  65 73 73 61 67 65 73 20  |he log messages |
00001090  74 68 61 74 20 61 72 65  20 63 6f 6d 69 6e 67 20  |that are coming |
000010a0  66 72 6f 6d 20 65 61 63  68 20 73 65 70 61 72 61  |from each separa|
000010b0  74 65 20 63 6f 6e 6e 65  63 74 69 6f 6e 0a 74 6f  |te connection.to|
000010c0  67 65 74 68 65 72 2e 20  54 68 69 73 20 63 61 6e  |gether. This can|
000010d0  20 62 65 20 64 6f 6e 65  20 75 73 69 6e 67 20 53  | be done using S|
000010e0  79 73 4c 6f 67 5f 4f 70  65 6e 53 65 73 73 69 6f  |ysLog_OpenSessio|
000010f0  6e 4c 6f 67 2e 0a 0a 53  79 73 4c 6f 67 5f 4f 70  |nLog...SysLog_Op|
00001100  65 6e 53 65 73 73 69 6f  6e 4c 6f 67 20 63 72 65  |enSessionLog cre|
00001110  61 74 65 73 20 61 20 73  70 65 63 69 61 6c 6c 79  |ates a specially|
00001120  2d 6e 61 6d 65 64 20 74  65 6d 70 6f 72 61 72 79  |-named temporary|
00001130  20 6c 6f 67 20 66 69 6c  65 2e 20 54 68 65 20 6c  | log file. The l|
00001140  6f 67 0a 65 6e 74 72 69  65 73 20 66 6f 72 20 74  |og.entries for t|
00001150  68 65 20 73 65 73 73 69  6f 6e 20 61 72 65 20 73  |he session are s|
00001160  74 6f 72 65 64 20 69 6e  20 74 68 69 73 20 6c 6f  |tored in this lo|
00001170  67 20 66 69 6c 65 2e 20  57 68 65 6e 20 74 68 65  |g file. When the|
00001180  20 74 65 6d 70 6f 72 61  72 79 20 6c 6f 67 0a 66  | temporary log.f|
00001190  69 6c 65 20 69 73 20 63  6c 6f 73 65 64 20 75 73  |ile is closed us|
000011a0  69 6e 67 20 53 79 73 4c  6f 67 5f 43 6c 6f 73 65  |ing SysLog_Close|
000011b0  53 65 73 73 69 6f 6e 4c  6f 67 2c 20 74 68 69 73  |SessionLog, this|
000011c0  20 64 61 74 61 20 69 73  20 61 70 70 65 6e 64 65  | data is appende|
000011d0  64 20 69 6e 20 6f 6e 65  0a 63 68 75 6e 6b 20 74  |d in one.chunk t|
000011e0  6f 20 74 68 65 20 65 6e  64 20 6f 66 20 74 68 65  |o the end of the|
000011f0  20 6d 61 69 6e 20 6c 6f  67 2e 0a 0a 53 79 73 4c  | main log...SysL|
00001200  6f 67 20 63 68 65 63 6b  73 20 66 6f 72 20 73 74  |og checks for st|
00001210  72 61 79 20 74 65 6d 70  6f 72 61 72 79 20 6c 6f  |ray temporary lo|
00001220  67 20 66 69 6c 65 73 20  77 68 65 6e 20 69 74 20  |g files when it |
00001230  69 6e 69 74 69 61 6c 69  73 65 73 20 61 6e 64 0a  |initialises and.|
00001240  66 69 6e 61 6c 69 73 65  73 2c 20 61 6e 64 20 61  |finalises, and a|
00001250  70 70 65 6e 64 73 20 74  68 65 6d 20 74 6f 20 74  |ppends them to t|
00001260  68 65 20 72 65 6c 65 76  61 6e 74 20 6c 6f 67 73  |he relevant logs|
00001270  2e 20 54 68 69 73 20 63  6f 70 65 73 20 77 69 74  |. This copes wit|
00001280  68 20 74 68 65 0a 73 69  74 75 61 74 69 6f 6e 20  |h the.situation |
00001290  77 68 65 72 65 20 61 6e  20 61 70 70 6c 69 63 61  |where an applica|
000012a0  74 69 6f 6e 20 63 72 61  73 68 65 73 20 6f 72 20  |tion crashes or |
000012b0  6f 74 68 65 72 77 69 73  65 20 65 78 69 74 73 20  |otherwise exits |
000012c0  77 69 74 68 6f 75 74 20  63 61 6c 6c 69 6e 67 0a  |without calling.|
000012d0  53 79 73 4c 6f 67 5f 43  6c 6f 73 65 53 65 73 73  |SysLog_CloseSess|
000012e0  69 6f 6e 4c 6f 67 2e 0a  0a 0a 3d 3d 3d 3d 3d 3d  |ionLog....======|
000012f0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00001330  3d 3d 3d 3d 3d 3d 0a 50  72 69 6f 72 69 74 69 65  |======.Prioritie|
00001340  73 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |s.--------------|
00001350  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001380  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0a 0a  |--------------..|
00001390  4d 65 73 73 61 67 65 20  70 72 69 6f 72 69 74 69  |Message prioriti|
000013a0  65 73 20 63 61 6e 20 62  65 20 69 6e 20 74 68 65  |es can be in the|
000013b0  20 72 61 6e 67 65 20 30  20 74 6f 20 32 35 35 2c  | range 0 to 255,|
000013c0  20 77 69 74 68 20 30 20  62 65 69 6e 67 20 74 68  | with 0 being th|
000013d0  65 20 68 69 67 68 65 73  74 0a 70 72 69 6f 72 69  |e highest.priori|
000013e0  74 79 20 61 6e 64 20 32  35 35 20 62 65 69 6e 67  |ty and 255 being|
000013f0  20 74 68 65 20 6c 6f 77  65 73 74 2e 20 55 6e 6c  | the lowest. Unl|
00001400  65 73 73 20 6f 74 68 65  72 77 69 73 65 20 73 70  |ess otherwise sp|
00001410  65 63 69 66 69 65 64 20  62 79 20 74 68 65 20 75  |ecified by the u|
00001420  73 65 72 2c 0a 6f 6e 6c  79 20 6d 65 73 73 61 67  |ser,.only messag|
00001430  65 73 20 77 69 74 68 20  70 72 69 6f 72 69 74 69  |es with prioriti|
00001440  65 73 20 6f 66 20 6c 65  73 73 20 74 68 61 6e 20  |es of less than |
00001450  31 32 35 20 61 72 65 20  73 74 6f 72 65 64 20 69  |125 are stored i|
00001460  6e 20 74 68 65 20 6c 6f  67 20 66 69 6c 65 73 2e  |n the log files.|
00001470  0a 59 6f 75 20 73 68 6f  75 6c 64 20 74 68 65 72  |.You should ther|
00001480  65 66 6f 72 65 20 74 68  69 6e 6b 20 61 62 6f 75  |efore think abou|
00001490  74 20 77 68 61 74 20 74  68 69 6e 67 73 20 74 68  |t what things th|
000014a0  65 20 75 73 65 72 20 69  73 20 6c 69 6b 65 6c 79  |e user is likely|
000014b0  20 74 6f 20 77 61 6e 74  20 74 6f 0a 68 61 76 65  | to want to.have|
000014c0  20 6c 6f 67 67 65 64 20  62 79 20 64 65 66 61 75  | logged by defau|
000014d0  6c 74 2c 20 61 6e 64 20  65 6e 73 75 72 65 20 74  |lt, and ensure t|
000014e0  68 61 74 20 74 68 65 73  65 20 74 68 69 6e 67 73  |hat these things|
000014f0  20 61 72 65 20 6c 6f 67  67 65 64 20 61 74 0a 61  | are logged at.a|
00001500  20 70 72 69 6f 72 69 74  79 20 6f 66 20 31 32 34  | priority of 124|
00001510  20 6f 72 20 6c 65 73 73  2e 0a 0a 54 68 65 20 70  | or less...The p|
00001520  72 69 6f 72 69 74 79 20  6f 66 20 65 72 72 6f 72  |riority of error|
00001530  73 20 6f 66 74 65 6e 20  64 65 70 65 6e 64 73 20  |s often depends |
00001540  6f 6e 20 68 6f 77 20 73  69 67 6e 69 66 69 63 61  |on how significa|
00001550  6e 74 20 74 68 65 20 63  6f 6e 73 65 71 75 65 6e  |nt the consequen|
00001560  63 65 73 20 6f 66 0a 74  68 65 20 65 72 72 6f 72  |ces of.the error|
00001570  20 61 72 65 2c 20 6e 6f  74 20 77 68 61 74 20 74  | are, not what t|
00001580  68 65 20 63 61 75 73 65  20 6f 66 20 69 74 20 69  |he cause of it i|
00001590  73 2e 20 65 2e 67 2e 20  73 6f 6d 65 74 69 6d 65  |s. e.g. sometime|
000015a0  73 20 22 6f 75 74 20 6f  66 20 6d 65 6d 6f 72 79  |s "out of memory|
000015b0  22 0a 77 69 6c 6c 20 62  65 20 61 6e 20 65 78 74  |".will be an ext|
000015c0  72 65 6d 65 6c 79 20 69  6d 70 6f 72 74 61 6e 74  |remely important|
000015d0  20 75 6e 72 65 63 6f 76  65 72 61 62 6c 65 20 65  | unrecoverable e|
000015e0  72 72 6f 72 20 28 62 65  63 61 75 73 65 20 74 68  |rror (because th|
000015f0  65 20 70 72 6f 67 72 61  6d 0a 63 61 6e 27 74 20  |e program.can't |
00001600  73 74 61 72 74 20 75 70  29 2c 20 61 6e 64 20 73  |start up), and s|
00001610  6f 6d 65 74 69 6d 65 73  20 69 74 20 77 69 6c 6c  |ometimes it will|
00001620  20 62 65 20 75 6e 69 6d  70 6f 72 74 61 6e 74 20  | be unimportant |
00001630  28 62 65 63 61 75 73 65  20 74 68 65 20 70 72 6f  |(because the pro|
00001640  67 72 61 6d 0a 63 61 6e  20 75 73 65 20 64 69 73  |gram.can use dis|
00001650  6b 20 69 6e 73 74 65 61  64 2c 20 6f 72 20 6d 61  |k instead, or ma|
00001660  79 62 65 20 74 72 79 20  61 67 61 69 6e 20 6c 61  |ybe try again la|
00001670  74 65 72 29 2e 0a 0a 0a  3d 3d 3d 3d 3d 3d 3d 3d  |ter)....========|
00001680  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
000016c0  3d 3d 3d 3d 0a 4c 6f 67  20 6e 61 6d 65 73 0a 2d  |====.Log names.-|
000016d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001710  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0a 0a 4c 6f 67  |-----------..Log|
00001720  20 6e 61 6d 65 73 20 61  72 65 20 75 73 65 64 20  | names are used |
00001730  61 73 20 74 68 65 20 6c  65 61 66 6e 61 6d 65 73  |as the leafnames|
00001740  20 74 6f 20 73 74 6f 72  65 20 74 68 65 20 6c 6f  | to store the lo|
00001750  67 73 20 61 73 2c 20 73  6f 20 74 68 65 79 20 6d  |gs as, so they m|
00001760  75 73 74 0a 63 6f 6d 70  6c 79 20 77 69 74 68 20  |ust.comply with |
00001770  74 68 65 20 72 75 6c 65  73 20 66 6f 72 20 52 49  |the rules for RI|
00001780  53 43 20 4f 53 20 6c 65  61 66 6e 61 6d 65 73 2e  |SC OS leafnames.|
00001790  20 54 68 65 79 20 6d 75  73 74 20 61 6c 73 6f 20  | They must also |
000017a0  6e 6f 74 20 62 65 20 6c  6f 6e 67 65 72 0a 74 68  |not be longer.th|
000017b0  61 6e 20 74 65 6e 20 63  68 61 72 61 63 74 65 72  |an ten character|
000017c0  73 2e 0a 0a 49 74 20 69  73 20 69 6e 74 65 6e 64  |s...It is intend|
000017d0  65 64 20 74 68 61 74 20  65 61 63 68 20 61 70 70  |ed that each app|
000017e0  6c 69 63 61 74 69 6f 6e  20 68 61 76 65 20 69 74  |lication have it|
000017f0  73 20 6f 77 6e 20 6c 6f  67 2c 20 73 6f 20 61 6e  |s own log, so an|
00001800  20 6f 62 76 69 6f 75 73  20 63 68 6f 69 63 65 0a  | obvious choice.|
00001810  66 6f 72 20 74 68 65 20  6c 6f 67 20 6e 61 6d 65  |for the log name|
00001820  20 69 73 20 74 68 65 20  61 70 70 6c 69 63 61 74  | is the applicat|
00001830  69 6f 6e 20 6e 61 6d 65  20 28 77 69 74 68 6f 75  |ion name (withou|
00001840  74 20 74 68 65 20 27 21  27 29 2e 20 56 65 72 79  |t the '!'). Very|
00001850  20 6c 61 72 67 65 0a 61  70 70 6c 69 63 61 74 69  | large.applicati|
00001860  6f 6e 73 20 63 6f 75 6c  64 20 68 61 76 65 20 6d  |ons could have m|
00001870  6f 72 65 20 74 68 61 6e  20 6f 6e 65 20 6c 6f 67  |ore than one log|
00001880  20 66 69 6c 65 20 2d 20  69 6e 20 77 68 69 63 68  | file - in which|
00001890  20 63 61 73 65 20 74 68  65 20 6e 61 6d 69 6e 67  | case the naming|
000018a0  0a 73 63 68 65 6d 65 20  69 73 20 75 6e 73 70 65  |.scheme is unspe|
000018b0  63 69 66 69 65 64 2e 20  54 72 79 20 61 6e 64 20  |cified. Try and |
000018c0  63 68 6f 6f 73 65 20 73  65 6e 73 69 62 6c 65 20  |choose sensible |
000018d0  6c 6f 67 20 6e 61 6d 65  73 2e 0a 0a 49 66 20 79  |log names...If y|
000018e0  6f 75 72 20 61 70 70 6c  69 63 61 74 69 6f 6e 20  |our application |
000018f0  69 73 20 67 6f 69 6e 67  20 74 6f 20 62 65 20 64  |is going to be d|
00001900  69 73 74 72 69 62 75 74  65 64 2c 20 79 6f 75 20  |istributed, you |
00001910  73 68 6f 75 6c 64 20 77  72 69 74 65 20 74 6f 0a  |should write to.|
00001920  73 75 70 70 6f 72 74 40  64 6f 67 67 79 73 6f 66  |support@doggysof|
00001930  74 2e 63 6f 2e 75 6b 2c  20 74 6f 20 72 65 71 75  |t.co.uk, to requ|
00001940  65 73 74 20 74 68 61 74  20 79 6f 75 72 20 6c 6f  |est that your lo|
00001950  67 20 6e 61 6d 65 20 62  65 20 66 6f 72 6d 61 6c  |g name be formal|
00001960  6c 79 0a 61 6c 6c 6f 63  61 74 65 64 2e 20 54 68  |ly.allocated. Th|
00001970  69 73 20 77 69 6c 6c 20  68 6f 70 65 66 75 6c 6c  |is will hopefull|
00001980  79 20 61 76 6f 69 64 20  68 61 76 69 6e 67 20 6d  |y avoid having m|
00001990  6f 72 65 20 74 68 61 6e  20 6f 6e 65 20 70 72 6f  |ore than one pro|
000019a0  67 72 61 6d 20 75 73 69  6e 67 20 74 68 65 0a 73  |gram using the.s|
000019b0  61 6d 65 20 6c 6f 67 20  66 69 6c 65 2e 0a 0a 54  |ame log file...T|
000019c0  68 65 20 66 6f 6c 6c 6f  77 69 6e 67 20 6c 6f 67  |he following log|
000019d0  20 6e 61 6d 65 73 20 61  72 65 20 72 65 73 65 72  | names are reser|
000019e0  76 65 64 20 66 6f 72 20  69 6e 74 65 72 6e 61 6c  |ved for internal|
000019f0  20 75 73 65 3a 0a 0a 20  20 61 6e 79 20 6e 61 6d  | use:..  any nam|
00001a00  65 20 62 65 67 69 6e 6e  69 6e 67 20 77 69 74 68  |e beginning with|
00001a10  20 61 20 27 2d 27 20 63  68 61 72 61 63 74 65 72  | a '-' character|
00001a20  0a 20 20 61 6e 79 20 6e  61 6d 65 20 62 65 67 69  |.  any name begi|
00001a30  6e 6e 69 6e 67 20 77 69  74 68 20 22 53 79 73 4c  |nning with "SysL|
00001a40  6f 67 22 0a 20 20 22 4f  6c 64 22 0a 0a 0a 3d 3d  |og".  "Old"...==|
00001a50  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00001a90  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 0a 4f 53 20 63 6f  |==========.OS co|
00001aa0  6d 6d 61 6e 64 73 0a 2d  2d 2d 2d 2d 2d 2d 2d 2d  |mmands.---------|
00001ab0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001af0  2d 2d 2d 0a 0a 2a 53 79  73 4c 6f 67 20 3c 6c 6f  |---..*SysLog <lo|
00001b00  67 20 6e 61 6d 65 3e 20  3c 70 72 69 6f 72 69 74  |g name> <priorit|
00001b10  79 3e 20 3c 6d 65 73 73  61 67 65 3e 0a 20 2d 2d  |y> <message>. --|
00001b20  2d 2d 2d 2d 0a 0a 41 64  64 73 20 61 20 74 69 6d  |----..Adds a tim|
00001b30  65 2d 73 74 61 6d 70 65  64 20 6d 65 73 73 61 67  |e-stamped messag|
00001b40  65 20 74 6f 20 74 68 65  20 6c 6f 67 20 66 69 6c  |e to the log fil|
00001b50  65 2c 20 69 66 20 61 6e  64 20 6f 6e 6c 79 20 69  |e, if and only i|
00001b60  66 20 74 68 65 20 73 70  65 63 69 66 69 65 64 0a  |f the specified.|
00001b70  6c 6f 67 20 66 69 6c 65  20 69 73 20 73 65 74 20  |log file is set |
00001b80  75 70 20 74 6f 20 6c 6f  67 20 6d 65 73 73 61 67  |up to log messag|
00001b90  65 73 20 6f 66 20 74 68  69 73 20 70 72 69 6f 72  |es of this prior|
00001ba0  69 74 79 2e 20 54 68 65  20 70 72 69 6f 72 69 74  |ity. The priorit|
00001bb0  79 20 6d 75 73 74 20 62  65 20 69 6e 0a 74 68 65  |y must be in.the|
00001bc0  20 72 61 6e 67 65 20 30  2d 32 35 35 2e 0a 0a 0a  | range 0-255....|
00001bd0  2a 53 79 73 4c 6f 67 20  3c 6c 6f 67 20 6e 61 6d  |*SysLog <log nam|
00001be0  65 3e 20 3c 6e 65 77 20  70 72 69 6f 72 69 74 79  |e> <new priority|
00001bf0  3e 0a 20 2d 2d 2d 2d 2d  2d 0a 0a 54 65 6d 70 6f  |>. ------..Tempo|
00001c00  72 61 72 69 6c 79 20 28  62 75 74 20 77 69 74 68  |rarily (but with|
00001c10  20 69 6d 6d 65 64 69 61  74 65 20 65 66 66 65 63  | immediate effec|
00001c20  74 29 20 63 68 61 6e 67  65 73 20 74 68 65 20 6c  |t) changes the l|
00001c30  6f 67 67 69 6e 67 20 70  72 69 6f 72 69 74 79 20  |ogging priority |
00001c40  6f 66 20 74 68 65 0a 73  70 65 63 69 66 69 65 64  |of the.specified|
00001c50  20 6c 6f 67 2e 20 54 68  65 20 70 72 69 6f 72 69  | log. The priori|
00001c60  74 79 20 6d 75 73 74 20  62 65 20 69 6e 20 74 68  |ty must be in th|
00001c70  65 20 72 61 6e 67 65 20  30 2d 32 35 36 2e 0a 0a  |e range 0-256...|
00001c80  0a 2a 53 79 73 4c 6f 67  20 4f 4e 7c 4f 46 46 0a  |.*SysLog ON|OFF.|
00001c90  20 2d 2d 2d 2d 2d 2d 0a  0a 2a 53 79 73 4c 6f 67  | ------..*SysLog|
00001ca0  20 4f 46 46 20 77 69 6c  6c 20 74 65 6d 70 6f 72  | OFF will tempor|
00001cb0  61 72 79 20 64 69 73 61  62 6c 65 20 53 79 73 4c  |ary disable SysL|
00001cc0  6f 67 20 2d 20 61 6c 6c  20 6c 6f 67 20 6d 65 73  |og - all log mes|
00001cd0  73 61 67 65 73 20 72 65  63 65 69 76 65 64 20 61  |sages received a|
00001ce0  66 74 65 72 0a 74 68 69  73 20 63 6f 6d 6d 61 6e  |fter.this comman|
00001cf0  64 20 69 73 20 69 73 73  75 65 64 20 77 69 6c 6c  |d is issued will|
00001d00  20 62 65 20 69 67 6e 6f  72 65 64 2e 20 2a 53 79  | be ignored. *Sy|
00001d10  73 4c 6f 67 20 4f 4e 20  72 65 73 75 6d 65 73 20  |sLog ON resumes |
00001d20  6e 6f 72 6d 61 6c 20 6f  70 65 72 61 74 69 6f 6e  |normal operation|
00001d30  2e 0a 0a 0a 2a 53 79 73  4c 6f 67 5f 46 6c 75 73  |....*SysLog_Flus|
00001d40  68 20 4f 4e 7c 4f 46 46  0a 20 2d 2d 2d 2d 2d 2d  |h ON|OFF. ------|
00001d50  2d 2d 2d 2d 2d 2d 0a 0a  2a 53 79 73 4c 6f 67 5f  |------..*SysLog_|
00001d60  46 6c 75 73 68 20 77 69  74 68 20 6e 6f 20 70 61  |Flush with no pa|
00001d70  72 61 6d 61 74 65 72 73  20 66 6c 75 73 68 65 73  |ramaters flushes|
00001d80  20 61 6c 6c 20 63 75 72  72 65 6e 74 6c 79 20 6f  | all currently o|
00001d90  70 65 6e 20 6c 6f 67 20  66 69 6c 65 73 20 74 6f  |pen log files to|
00001da0  0a 64 69 73 6b 2e 20 49  66 20 69 74 20 75 73 65  |.disk. If it use|
00001db0  64 20 77 69 74 68 20 74  68 65 20 70 61 72 61 6d  |d with the param|
00001dc0  65 74 65 72 20 27 4f 4e  27 20 74 68 65 6e 20 69  |eter 'ON' then i|
00001dd0  74 20 63 61 75 73 65 73  20 61 6c 6c 20 6c 6f 67  |t causes all log|
00001de0  20 66 69 6c 65 73 20 74  6f 20 62 65 0a 66 6c 75  | files to be.flu|
00001df0  73 68 65 64 20 69 6d 6d  65 64 69 61 74 65 6c 79  |shed immediately|
00001e00  20 61 66 74 65 72 20 65  61 63 68 20 6d 65 73 73  | after each mess|
00001e10  61 67 65 20 69 73 20 77  72 69 74 74 65 6e 20 74  |age is written t|
00001e20  6f 20 74 68 65 6d 2e 20  2a 53 79 73 4c 6f 67 5f  |o them. *SysLog_|
00001e30  46 6c 75 73 68 20 4f 46  46 0a 64 69 73 61 62 6c  |Flush OFF.disabl|
00001e40  65 73 20 74 68 69 73 20  62 65 68 61 76 69 6f 75  |es this behaviou|
00001e50  72 2e 20 28 54 68 69 73  20 69 73 20 69 6e 74 65  |r. (This is inte|
00001e60  6e 64 65 64 20 66 6f 72  20 75 73 65 20 77 68 65  |nded for use whe|
00001e70  6e 20 74 68 65 20 61 20  70 72 6f 67 72 61 6d 20  |n the a program |
00001e80  69 73 0a 62 65 69 6e 67  20 64 65 62 75 67 67 65  |is.being debugge|
00001e90  64 2c 20 61 6e 64 20 6b  65 65 70 73 20 63 72 61  |d, and keeps cra|
00001ea0  73 68 69 6e 67 20 74 68  65 20 63 6f 6d 70 75 74  |shing the comput|
00001eb0  65 72 2e 20 57 69 74 68  20 53 79 73 4c 6f 67 5f  |er. With SysLog_|
00001ec0  46 6c 75 73 68 20 4f 4e  2c 0a 79 6f 75 27 72 65  |Flush ON,.you're|
00001ed0  20 67 75 61 72 61 6e 74  65 65 64 20 74 68 61 74  | guaranteed that|
00001ee0  20 61 6c 6c 20 74 68 65  20 6c 6f 67 20 69 6e 66  | all the log inf|
00001ef0  6f 72 6d 61 74 69 6f 6e  20 79 6f 75 72 20 70 72  |ormation your pr|
00001f00  6f 67 72 61 6d 20 70 72  6f 64 75 63 65 73 20 62  |ogram produces b|
00001f10  65 66 6f 72 65 0a 69 74  20 63 72 61 73 68 65 73  |efore.it crashes|
00001f20  20 77 69 6c 6c 20 61 63  74 75 61 6c 6c 79 20 62  | will actually b|
00001f30  65 20 61 76 61 69 6c 61  62 6c 65 20 61 66 74 65  |e available afte|
00001f40  72 20 61 20 72 65 2d 62  6f 6f 74 2e 20 49 74 20  |r a re-boot. It |
00001f50  61 6c 73 6f 20 6d 61 6b  65 73 20 6c 6f 67 67 69  |also makes loggi|
00001f60  6e 67 0a 2a 76 65 72 79  20 73 6c 6f 77 2a 2e 29  |ng.*very slow*.)|
00001f70  0a 0a 0a 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |...=============|
00001f80  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00001fb0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0a  |===============.|
00001fc0  53 57 49 73 0a 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |SWIs.-----------|
00001fd0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002010  2d 0a 0a 53 79 73 4c 6f  67 5f 4c 6f 67 4d 65 73  |-..SysLog_LogMes|
00002020  73 61 67 65 20 28 26 34  43 38 38 30 29 0a 2d 2d  |sage (&4C880).--|
00002030  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
00002040  52 30 2d 3e 20 6c 6f 67  20 6e 61 6d 65 2c 20 6f  |R0-> log name, o|
00002050  72 20 3d 20 73 65 73 73  69 6f 6e 20 6c 6f 67 20  |r = session log |
00002060  68 61 6e 64 6c 65 0a 52  31 2d 3e 20 74 65 78 74  |handle.R1-> text|
00002070  20 74 6f 20 6c 6f 67 0a  52 32 20 3d 20 70 72 69  | to log.R2 = pri|
00002080  6f 72 69 74 79 0a 0a 41  64 64 73 20 61 20 74 69  |ority..Adds a ti|
00002090  6d 65 2d 73 74 61 6d 70  65 64 20 6d 65 73 73 61  |me-stamped messa|
000020a0  67 65 20 74 6f 20 74 68  65 20 6c 6f 67 20 66 69  |ge to the log fi|
000020b0  6c 65 2c 20 69 66 20 61  6e 64 20 6f 6e 6c 79 20  |le, if and only |
000020c0  69 66 20 74 68 65 20 73  70 65 63 69 66 69 65 64  |if the specified|
000020d0  0a 6c 6f 67 20 66 69 6c  65 20 69 73 20 73 65 74  |.log file is set|
000020e0  20 75 70 20 74 6f 20 6c  6f 67 20 6d 65 73 73 61  | up to log messa|
000020f0  67 65 73 20 6f 66 20 74  68 69 73 20 70 72 69 6f  |ges of this prio|
00002100  72 69 74 79 2e 20 54 68  65 20 74 65 78 74 20 74  |rity. The text t|
00002110  6f 20 6c 6f 67 20 6d 75  73 74 0a 6e 6f 74 20 62  |o log must.not b|
00002120  65 20 6c 6f 6e 67 65 72  20 74 68 61 6e 20 31 30  |e longer than 10|
00002130  32 34 20 62 79 74 65 73  2e 20 54 68 65 20 70 72  |24 bytes. The pr|
00002140  69 6f 72 69 74 79 20 6d  75 73 74 20 62 65 20 69  |iority must be i|
00002150  6e 20 74 68 65 20 72 61  6e 67 65 20 30 2d 32 35  |n the range 0-25|
00002160  35 2e 0a 0a 0a 53 79 73  4c 6f 67 5f 47 65 74 4c  |5....SysLog_GetL|
00002170  6f 67 4c 65 76 65 6c 20  28 26 34 43 38 38 31 29  |ogLevel (&4C881)|
00002180  0a 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
00002190  2d 2d 2d 0a 52 30 2d 3e  20 6c 6f 67 20 6e 61 6d  |---.R0-> log nam|
000021a0  65 2c 20 6f 72 20 3d 20  73 65 73 73 69 6f 6e 20  |e, or = session |
000021b0  6c 6f 67 20 68 61 6e 64  6c 65 0a 65 78 69 74 3a  |log handle.exit:|
000021c0  0a 52 30 20 3d 20 70 72  69 6f 72 69 74 79 0a 0a  |.R0 = priority..|
000021d0  52 65 61 64 73 20 74 68  65 20 6c 6f 67 67 69 6e  |Reads the loggin|
000021e0  67 20 6c 65 76 65 6c 20  66 6f 72 20 74 68 65 20  |g level for the |
000021f0  73 70 65 63 69 66 69 65  64 20 6c 6f 67 2e 20 4d  |specified log. M|
00002200  65 73 73 61 67 65 73 20  6f 66 20 2a 6c 65 73 73  |essages of *less|
00002210  20 74 68 61 6e 2a 20 74  68 65 0a 72 65 74 75 72  | than* the.retur|
00002220  6e 65 64 20 70 72 69 6f  72 69 74 79 20 61 72 65  |ned priority are|
00002230  20 62 65 69 6e 67 20 6c  6f 67 67 65 64 2e 20 54  | being logged. T|
00002240  68 69 73 20 63 61 6e 20  62 65 20 75 73 65 64 20  |his can be used |
00002250  74 6f 20 61 76 6f 69 64  20 63 72 65 61 74 69 6f  |to avoid creatio|
00002260  6e 20 6f 66 0a 6c 6f 67  67 69 6e 67 20 69 6e 66  |n of.logging inf|
00002270  6f 72 6d 61 74 69 6f 6e  20 74 68 61 74 20 69 73  |ormation that is|
00002280  20 6f 6e 6c 79 20 67 6f  69 6e 67 20 74 6f 20 62  | only going to b|
00002290  65 20 64 69 73 63 61 72  64 65 64 20 62 79 20 53  |e discarded by S|
000022a0  79 73 4c 6f 67 5f 4c 6f  67 4d 65 73 73 61 67 65  |ysLog_LogMessage|
000022b0  0a 61 6e 79 77 61 79 2e  20 49 6e 20 73 6f 6d 65  |.anyway. In some|
000022c0  20 63 61 73 65 73 20 69  74 20 63 6f 75 6c 64 20  | cases it could |
000022d0  65 76 65 6e 20 62 65 20  75 73 65 64 20 74 6f 20  |even be used to |
000022e0  64 65 63 69 64 65 20 77  68 69 63 68 20 76 65 72  |decide which ver|
000022f0  73 69 6f 6e 20 6f 66 0a  61 20 70 72 6f 67 72 61  |sion of.a progra|
00002300  6d 20 74 6f 20 6c 6f 61  64 20 28 65 2e 67 2e 20  |m to load (e.g. |
00002310  77 68 65 74 68 65 72 20  74 6f 20 6c 6f 61 64 20  |whether to load |
00002320  61 20 64 65 62 75 67 67  69 6e 67 20 76 65 72 73  |a debugging vers|
00002330  69 6f 6e 20 6f 66 20 54  65 72 6d 69 74 65 49 50  |ion of TermiteIP|
00002340  29 2e 0a 0a 0a 53 79 73  4c 6f 67 5f 46 6c 75 73  |)....SysLog_Flus|
00002350  68 4c 6f 67 20 28 26 34  43 38 38 32 29 0a 2d 2d  |hLog (&4C882).--|
00002360  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 52 30  |-------------.R0|
00002370  2d 3e 20 6c 6f 67 20 6e  61 6d 65 2c 20 6f 72 20  |-> log name, or |
00002380  3d 20 73 65 73 73 69 6f  6e 20 6c 6f 67 20 68 61  |= session log ha|
00002390  6e 64 6c 65 2c 20 6f 72  20 3d 20 30 20 74 6f 20  |ndle, or = 0 to |
000023a0  66 6c 75 73 68 20 61 6c  6c 20 6c 6f 67 73 0a 0a  |flush all logs..|
000023b0  45 6e 73 75 72 65 73 20  74 68 65 20 73 70 65 63  |Ensures the spec|
000023c0  69 66 69 65 64 20 6c 6f  67 20 28 6f 72 20 61 6c  |ified log (or al|
000023d0  6c 20 6c 6f 67 73 29 20  61 72 65 20 66 75 6c 6c  |l logs) are full|
000023e0  79 20 77 72 69 74 74 65  6e 20 74 6f 20 64 69 73  |y written to dis|
000023f0  6b 2c 20 61 6e 64 20 74  68 65 0a 66 69 6c 65 73  |k, and the.files|
00002400  20 63 6c 6f 73 65 64 2e  20 54 68 69 73 20 63 61  | closed. This ca|
00002410  6e 20 62 65 20 75 73 65  66 75 6c 20 74 6f 20 6d  |n be useful to m|
00002420  61 6b 65 20 73 75 72 65  20 74 68 61 74 20 74 68  |ake sure that th|
00002430  65 20 75 73 65 72 20 69  73 20 69 6d 6d 65 64 69  |e user is immedi|
00002440  61 74 65 6c 79 0a 61 62  6c 65 20 74 6f 20 72 65  |ately.able to re|
00002450  61 64 20 64 61 74 61 20  74 68 61 74 20 68 61 73  |ad data that has|
00002460  20 6a 75 73 74 20 62 65  65 6e 20 77 72 69 74 74  | just been writt|
00002470  65 6e 20 74 6f 20 74 68  65 20 6c 6f 67 2e 0a 0a  |en to the log...|
00002480  0a 53 79 73 4c 6f 67 5f  53 65 74 4c 6f 67 4c 65  |.SysLog_SetLogLe|
00002490  76 65 6c 20 28 26 34 43  38 38 33 29 0a 2d 2d 2d  |vel (&4C883).---|
000024a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
000024b0  52 30 2d 3e 20 6c 6f 67  20 6e 61 6d 65 2c 20 6f  |R0-> log name, o|
000024c0  72 20 3d 20 73 65 73 73  69 6f 6e 20 6c 6f 67 20  |r = session log |
000024d0  68 61 6e 64 6c 65 0a 52  31 20 3d 20 6e 65 77 20  |handle.R1 = new |
000024e0  6c 6f 67 67 69 6e 67 20  6c 65 76 65 6c 0a 0a 53  |logging level..S|
000024f0  65 74 73 20 74 68 65 20  6c 6f 67 67 69 6e 67 20  |ets the logging |
00002500  6c 65 76 65 6c 20 66 6f  72 20 74 68 65 20 73 70  |level for the sp|
00002510  65 63 69 66 69 65 64 20  6c 6f 67 2e 20 54 68 69  |ecified log. Thi|
00002520  73 20 53 57 49 20 69 73  20 70 72 6f 76 69 64 65  |s SWI is provide|
00002530  64 20 66 6f 72 0a 64 65  62 75 67 67 69 6e 67 20  |d for.debugging |
00002540  61 6e 64 20 69 6e 74 65  72 6e 61 6c 20 75 73 65  |and internal use|
00002550  20 6f 6e 6c 79 2c 20 61  6e 64 20 53 48 4f 55 4c  | only, and SHOUL|
00002560  44 20 4e 4f 54 20 42 45  20 55 53 45 44 20 69 6e  |D NOT BE USED in|
00002570  20 64 69 73 74 72 69 62  75 74 69 6f 6e 0a 63 6f  | distribution.co|
00002580  64 65 2e 20 54 68 65 20  6c 6f 67 67 69 6e 67 20  |de. The logging |
00002590  6c 65 76 65 6c 20 69 73  20 74 68 65 20 75 73 65  |level is the use|
000025a0  72 27 73 20 64 65 63 69  73 69 6f 6e 2c 20 6e 6f  |r's decision, no|
000025b0  74 20 74 68 65 20 70 72  6f 67 72 61 6d 6d 65 72  |t the programmer|
000025c0  27 73 2e 0a 0a 0a 53 79  73 4c 6f 67 5f 4c 6f 67  |'s....SysLog_Log|
000025d0  55 6e 73 74 61 6d 70 65  64 20 28 26 34 43 38 38  |Unstamped (&4C88|
000025e0  34 29 0a 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |4).-------------|
000025f0  2d 2d 2d 2d 2d 2d 0a 52  30 2d 3e 20 6c 6f 67 20  |------.R0-> log |
00002600  6e 61 6d 65 2c 20 6f 72  20 3d 20 73 65 73 73 69  |name, or = sessi|
00002610  6f 6e 20 6c 6f 67 20 68  61 6e 64 6c 65 0a 52 31  |on log handle.R1|
00002620  2d 3e 20 74 65 78 74 20  74 6f 20 6c 6f 67 0a 52  |-> text to log.R|
00002630  32 20 3d 20 70 72 69 6f  72 69 74 79 0a 0a 41 64  |2 = priority..Ad|
00002640  64 73 20 61 20 6d 65 73  73 61 67 65 20 74 6f 20  |ds a message to |
00002650  74 68 65 20 6c 6f 67 20  66 69 6c 65 2c 20 69 66  |the log file, if|
00002660  20 61 6e 64 20 6f 6e 6c  79 20 69 66 20 74 68 65  | and only if the|
00002670  20 73 70 65 63 69 66 69  65 64 20 6c 6f 67 20 66  | specified log f|
00002680  69 6c 65 20 69 73 20 73  65 74 0a 74 6f 20 6c 6f  |ile is set.to lo|
00002690  67 20 6d 65 73 73 61 67  65 73 20 6f 66 20 74 68  |g messages of th|
000026a0  69 73 20 70 72 69 6f 72  69 74 79 2e 20 54 68 65  |is priority. The|
000026b0  20 74 65 78 74 20 74 6f  20 6c 6f 67 20 6d 75 73  | text to log mus|
000026c0  74 20 6e 6f 74 20 62 65  20 6c 6f 6e 67 65 72 20  |t not be longer |
000026d0  74 68 61 6e 0a 31 30 32  34 20 62 79 74 65 73 2e  |than.1024 bytes.|
000026e0  20 54 68 65 20 70 72 69  6f 72 69 74 79 20 6d 75  | The priority mu|
000026f0  73 74 20 62 65 20 69 6e  20 74 68 65 20 72 61 6e  |st be in the ran|
00002700  67 65 20 30 2d 32 35 35  2e 20 49 74 20 69 73 20  |ge 0-255. It is |
00002710  72 65 63 6f 6d 6d 65 6e  64 65 64 20 74 68 61 74  |recommended that|
00002720  0a 79 6f 75 20 75 73 65  20 53 79 73 4c 6f 67 5f  |.you use SysLog_|
00002730  4c 6f 67 4d 65 73 73 61  67 65 20 66 6f 72 20 61  |LogMessage for a|
00002740  6c 6c 20 6e 6f 72 6d 61  6c 20 6c 6f 67 20 65 6e  |ll normal log en|
00002750  74 72 69 65 73 2e 0a 0a  0a 53 79 73 4c 6f 67 5f  |tries....SysLog_|
00002760  49 6e 64 65 6e 74 20 28  26 34 43 38 38 35 29 0a  |Indent (&4C885).|
00002770  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 52 30  |-------------.R0|
00002780  2d 3e 20 6c 6f 67 20 6e  61 6d 65 2c 20 6f 72 20  |-> log name, or |
00002790  3d 20 73 65 73 73 69 6f  6e 20 6c 6f 67 20 68 61  |= session log ha|
000027a0  6e 64 6c 65 0a 0a 49 6e  63 72 65 6d 65 6e 74 73  |ndle..Increments|
000027b0  20 74 68 65 20 6c 6f 67  20 69 6e 64 65 6e 74 20  | the log indent |
000027c0  6c 65 76 65 6c 2e 20 49  6e 20 6c 6f 67 20 6c 69  |level. In log li|
000027d0  6e 65 73 20 67 65 6e 65  72 61 74 65 64 20 62 79  |nes generated by|
000027e0  0a 53 79 73 4c 6f 67 5f  4c 6f 67 4d 65 73 73 61  |.SysLog_LogMessa|
000027f0  67 65 2c 20 74 68 65 72  65 20 61 72 65 20 3c 69  |ge, there are <i|
00002800  6e 64 65 6e 74 5f 6c 65  76 65 6c 20 2b 20 31 3e  |ndent_level + 1>|
00002810  20 73 70 61 63 65 73 20  69 6e 20 62 65 74 77 65  | spaces in betwe|
00002820  65 6e 20 74 68 65 0a 70  72 69 6f 72 69 74 79 20  |en the.priority |
00002830  61 6e 64 20 74 68 65 20  6d 65 73 73 61 67 65 2e  |and the message.|
00002840  20 54 68 69 73 20 63 61  6e 20 62 65 20 75 73 65  | This can be use|
00002850  66 75 6c 20 74 6f 20 73  68 6f 77 20 74 68 65 20  |ful to show the |
00002860  68 69 65 72 61 72 63 68  79 20 6f 66 20 74 68 65  |hierarchy of the|
00002870  0a 66 75 6e 63 74 69 6f  6e 73 20 77 68 69 63 68  |.functions which|
00002880  20 61 72 65 20 70 72 6f  64 75 63 69 6e 67 20 6c  | are producing l|
00002890  6f 67 67 69 6e 67 20 6f  75 74 70 75 74 2e 20 54  |ogging output. T|
000028a0  68 65 20 69 6e 64 65 6e  74 20 6c 65 76 65 6c 20  |he indent level |
000028b0  69 73 20 69 6e 69 74 69  61 6c 6c 79 0a 7a 65 72  |is initially.zer|
000028c0  6f 2e 0a 0a 0a 53 79 73  4c 6f 67 5f 55 6e 49 6e  |o....SysLog_UnIn|
000028d0  64 65 6e 74 20 28 26 34  43 38 38 36 29 0a 2d 2d  |dent (&4C886).--|
000028e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 52 30  |-------------.R0|
000028f0  2d 3e 20 6c 6f 67 20 6e  61 6d 65 2c 20 6f 72 20  |-> log name, or |
00002900  3d 20 73 65 73 73 69 6f  6e 20 6c 6f 67 20 68 61  |= session log ha|
00002910  6e 64 6c 65 0a 0a 44 65  63 72 65 6d 65 6e 74 73  |ndle..Decrements|
00002920  20 74 68 65 20 6c 6f 67  20 69 6e 64 65 6e 74 20  | the log indent |
00002930  6c 65 76 65 6c 2e 20 28  49 66 20 69 74 20 69 73  |level. (If it is|
00002940  20 7a 65 72 6f 20 69 74  20 69 73 20 6e 6f 74 20  | zero it is not |
00002950  64 65 63 72 65 6d 65 6e  74 65 64 2e 29 0a 0a 0a  |decremented.)...|
00002960  53 79 73 4c 6f 67 5f 4e  6f 49 6e 64 65 6e 74 20  |SysLog_NoIndent |
00002970  28 26 34 43 38 38 37 29  0a 2d 2d 2d 2d 2d 2d 2d  |(&4C887).-------|
00002980  2d 2d 2d 2d 2d 2d 2d 2d  0a 52 30 2d 3e 20 6c 6f  |--------.R0-> lo|
00002990  67 20 6e 61 6d 65 2c 20  6f 72 20 3d 20 73 65 73  |g name, or = ses|
000029a0  73 69 6f 6e 20 6c 6f 67  20 68 61 6e 64 6c 65 0a  |sion log handle.|
000029b0  0a 53 65 74 73 20 74 68  65 20 6c 6f 67 20 69 6e  |.Sets the log in|
000029c0  64 65 6e 74 20 6c 65 76  65 6c 20 74 6f 20 7a 65  |dent level to ze|
000029d0  72 6f 2e 20 54 68 69 73  20 73 68 6f 75 6c 64 20  |ro. This should |
000029e0  62 65 20 63 61 6c 6c 65  64 20 77 68 65 6e 20 79  |be called when y|
000029f0  6f 75 72 20 70 72 6f 67  72 61 6d 0a 6c 6f 61 64  |our program.load|
00002a00  73 2c 20 69 66 20 79 6f  75 20 61 72 65 20 75 73  |s, if you are us|
00002a10  69 6e 67 20 53 79 73 4c  6f 67 5f 49 6e 64 65 6e  |ing SysLog_Inden|
00002a20  74 2f 55 6e 49 6e 64 65  6e 74 2e 0a 0a 0a 53 79  |t/UnIndent....Sy|
00002a30  73 4c 6f 67 5f 4f 70 65  6e 53 65 73 73 69 6f 6e  |sLog_OpenSession|
00002a40  4c 6f 67 20 28 26 34 43  38 38 38 29 0a 2d 2d 2d  |Log (&4C888).---|
00002a50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002a60  2d 2d 0a 52 30 2d 3e 20  6c 6f 67 20 6e 61 6d 65  |--.R0-> log name|
00002a70  0a 52 31 20 3d 20 70 72  69 6f 72 69 74 79 0a 65  |.R1 = priority.e|
00002a80  78 69 74 3a 0a 52 30 20  3d 20 73 65 73 73 69 6f  |xit:.R0 = sessio|
00002a90  6e 20 6c 6f 67 20 68 61  6e 64 6c 65 20 28 6f 72  |n log handle (or|
00002aa0  20 30 29 0a 0a 43 72 65  61 74 65 73 20 61 20 74  | 0)..Creates a t|
00002ab0  65 6d 70 6f 72 61 72 79  20 73 65 73 73 69 6f 6e  |emporary session|
00002ac0  20 6c 6f 67 20 66 69 6c  65 2e 20 57 68 65 6e 20  | log file. When |
00002ad0  74 68 65 20 73 65 73 73  69 6f 6e 20 6c 6f 67 20  |the session log |
00002ae0  69 73 20 63 6c 6f 73 65  64 20 28 75 73 69 6e 67  |is closed (using|
00002af0  0a 53 79 73 4c 6f 67 5f  43 6c 6f 73 65 53 65 73  |.SysLog_CloseSes|
00002b00  73 69 6f 6e 4c 6f 67 2c  20 62 65 6c 6f 77 29 2c  |sionLog, below),|
00002b10  20 74 68 65 20 73 65 73  73 69 6f 6e 20 6c 6f 67  | the session log|
00002b20  20 69 73 20 61 70 70 65  6e 64 65 64 20 74 6f 20  | is appended to |
00002b30  74 68 65 20 6d 61 69 6e  20 6c 6f 67 0a 61 73 20  |the main log.as |
00002b40  73 70 65 63 69 66 69 65  64 20 69 6e 20 52 30 20  |specified in R0 |
00002b50  6f 6e 20 65 6e 74 72 79  20 74 6f 20 74 68 69 73  |on entry to this|
00002b60  20 53 57 49 2e 20 49 66  20 74 68 65 20 6d 61 69  | SWI. If the mai|
00002b70  6e 20 6c 6f 67 20 69 73  20 73 65 74 20 74 6f 20  |n log is set to |
00002b80  69 67 6e 6f 72 65 0a 6c  6f 67 20 65 6e 74 72 69  |ignore.log entri|
00002b90  65 73 20 6f 66 20 74 68  65 20 70 72 69 6f 72 69  |es of the priori|
00002ba0  74 79 20 73 70 65 63 69  66 69 65 64 20 74 68 65  |ty specified the|
00002bb0  6e 20 7a 65 72 6f 20 77  69 6c 6c 20 62 65 20 72  |n zero will be r|
00002bc0  65 74 75 72 6e 65 64 20  66 6f 72 20 74 68 65 0a  |eturned for the.|
00002bd0  73 65 73 73 69 6f 6e 20  6c 6f 67 20 68 61 6e 64  |session log hand|
00002be0  6c 65 2e 20 54 68 69 73  20 64 6f 65 73 20 6e 6f  |le. This does no|
00002bf0  74 20 6e 65 63 65 73 73  61 72 69 6c 79 20 72 65  |t necessarily re|
00002c00  71 75 69 72 65 20 73 70  65 63 69 61 6c 20 63 61  |quire special ca|
00002c10  73 65 20 63 6f 64 65 2c  20 61 73 0a 6f 74 68 65  |se code, as.othe|
00002c20  72 20 53 57 49 73 20 77  68 69 63 68 20 61 63 63  |r SWIs which acc|
00002c30  65 70 74 20 73 65 73 73  69 6f 6e 20 6c 6f 67 20  |ept session log |
00002c40  68 61 6e 64 6c 65 73 20  77 69 6c 6c 20 61 63 63  |handles will acc|
00002c50  65 70 74 20 61 20 68 61  6e 64 6c 65 20 6f 66 20  |ept a handle of |
00002c60  7a 65 72 6f 20 61 6e 64  0a 64 6f 20 6e 6f 74 68  |zero and.do noth|
00002c70  69 6e 67 2e 0a 0a 0a 53  79 73 4c 6f 67 5f 43 6c  |ing....SysLog_Cl|
00002c80  6f 73 65 53 65 73 73 69  6f 6e 4c 6f 67 20 28 26  |oseSessionLog (&|
00002c90  34 43 38 38 39 29 0a 2d  2d 2d 2d 2d 2d 2d 2d 2d  |4C889).---------|
00002ca0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 52 30  |-------------.R0|
00002cb0  20 3d 20 73 65 73 73 69  6f 6e 20 6c 6f 67 20 68  | = session log h|
00002cc0  61 6e 64 6c 65 0a 0a 43  6c 6f 73 65 73 20 74 68  |andle..Closes th|
00002cd0  65 20 73 70 65 63 69 66  69 65 64 20 74 65 6d 70  |e specified temp|
00002ce0  6f 72 61 72 79 20 73 65  73 73 69 6f 6e 20 6c 6f  |orary session lo|
00002cf0  67 20 61 6e 64 20 61 70  70 65 6e 64 73 20 69 74  |g and appends it|
00002d00  20 74 6f 20 74 68 65 20  61 70 70 72 6f 70 72 69  | to the appropri|
00002d10  61 74 65 0a 6d 61 69 6e  20 6c 6f 67 20 66 69 6c  |ate.main log fil|
00002d20  65 2e 20 54 68 65 20 73  70 65 63 69 66 69 65 64  |e. The specified|
00002d30  20 73 65 73 73 69 6f 6e  20 6c 6f 67 20 68 61 6e  | session log han|
00002d40  64 6c 65 20 69 73 20 6e  6f 20 6c 6f 6e 67 65 72  |dle is no longer|
00002d50  20 76 61 6c 69 64 2e 0a  0a 0a 53 79 73 4c 6f 67  | valid....SysLog|
00002d60  5f 4c 6f 67 44 61 74 61  20 28 26 34 43 38 38 41  |_LogData (&4C88A|
00002d70  29 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |).--------------|
00002d80  0a 52 30 2d 3e 20 6c 6f  67 20 6e 61 6d 65 2c 20  |.R0-> log name, |
00002d90  6f 72 20 3d 20 73 65 73  73 69 6f 6e 20 6c 6f 67  |or = session log|
00002da0  20 68 61 6e 64 6c 65 0a  52 31 20 3d 20 70 72 69  | handle.R1 = pri|
00002db0  6f 72 69 74 79 0a 52 32  2d 3e 20 64 61 74 61 20  |ority.R2-> data |
00002dc0  74 6f 20 6c 6f 67 0a 52  33 20 3d 20 6e 75 6d 62  |to log.R3 = numb|
00002dd0  65 72 20 6f 66 20 62 79  74 65 73 20 74 6f 20 6c  |er of bytes to l|
00002de0  6f 67 0a 52 34 20 3d 20  76 61 6c 75 65 20 74 6f  |og.R4 = value to|
00002df0  20 72 65 70 6f 72 74 20  61 73 20 62 6c 6f 63 6b  | report as block|
00002e00  20 6f 66 66 73 65 74 20  28 2d 31 20 6e 6f 74 20  | offset (-1 not |
00002e10  74 6f 20 73 68 6f 77 20  62 6c 6f 63 6b 20 6f 66  |to show block of|
00002e20  66 73 65 74 29 0a 0a 4c  6f 67 73 20 61 20 62 6c  |fset)..Logs a bl|
00002e30  6f 63 6b 20 6f 66 20 64  61 74 61 2c 20 69 6e 20  |ock of data, in |
00002e40  61 20 68 65 78 2d 61 6e  64 2d 41 53 43 49 49 20  |a hex-and-ASCII |
00002e50  66 6f 72 6d 61 74 20 73  69 6d 69 6c 61 72 20 74  |format similar t|
00002e60  6f 20 74 68 61 74 20 70  72 6f 64 75 63 65 64 20  |o that produced |
00002e70  62 79 0a 2a 44 75 6d 70  2e 20 54 68 65 20 62 6c  |by.*Dump. The bl|
00002e80  6f 63 6b 20 6f 66 66 73  65 74 20 69 73 20 74 68  |ock offset is th|
00002e90  65 20 76 61 6c 75 65 20  74 68 61 74 20 69 73 20  |e value that is |
00002ea0  70 72 69 6e 74 65 64 20  61 74 20 74 68 65 20 62  |printed at the b|
00002eb0  65 67 69 6e 6e 69 6e 67  20 6f 66 0a 65 61 63 68  |eginning of.each|
00002ec0  20 6c 69 6e 65 2c 20 77  68 69 63 68 20 69 73 20  | line, which is |
00002ed0  65 71 75 61 6c 20 74 6f  20 74 68 65 20 76 61 6c  |equal to the val|
00002ee0  75 65 20 67 69 76 65 6e  20 6f 6e 20 65 6e 74 72  |ue given on entr|
00002ef0  79 20 70 6c 75 73 20 74  68 65 20 6e 75 6d 62 65  |y plus the numbe|
00002f00  72 20 6f 66 0a 62 79 74  65 73 20 61 6c 72 65 61  |r of.bytes alrea|
00002f10  64 79 20 64 69 73 70 6c  61 79 65 64 2e 20 49 66  |dy displayed. If|
00002f20  20 2d 31 20 69 73 20 75  73 65 64 20 61 73 20 74  | -1 is used as t|
00002f30  68 65 20 62 6c 6f 63 6b  20 6f 66 66 73 65 74 20  |he block offset |
00002f40  74 68 65 6e 20 74 68 65  20 66 69 65 6c 64 0a 77  |then the field.w|
00002f50  69 6c 6c 20 62 65 20 6f  6d 69 74 74 65 64 2e 20  |ill be omitted. |
00002f60  4e 6f 74 65 20 74 68 61  74 20 69 66 20 74 68 65  |Note that if the|
00002f70  20 6e 75 6d 62 65 72 20  6f 66 20 62 79 74 65 73  | number of bytes|
00002f80  20 74 6f 20 6c 6f 67 20  69 73 20 6f 76 65 72 20  | to log is over |
00002f90  31 30 4b 42 20 74 68 65  6e 0a 74 68 65 20 53 57  |10KB then.the SW|
00002fa0  49 20 77 69 6c 6c 20 72  65 74 75 72 6e 20 77 69  |I will return wi|
00002fb0  74 68 20 61 6e 20 65 72  72 6f 72 20 2d 20 6c 6f  |th an error - lo|
00002fc0  67 67 69 6e 67 20 73 75  63 68 20 61 20 6c 61 72  |gging such a lar|
00002fd0  67 65 20 61 6d 6f 75 6e  74 20 6f 66 20 64 61 74  |ge amount of dat|
00002fe0  61 20 69 6e 0a 6f 6e 65  20 67 6f 20 69 73 20 61  |a in.one go is a|
00002ff0  6c 6d 6f 73 74 20 63 65  72 74 61 69 6e 6c 79 20  |lmost certainly |
00003000  61 20 62 75 67 2c 20 73  6f 20 53 79 73 4c 6f 67  |a bug, so SysLog|
00003010  20 66 61 75 6c 74 73 20  69 74 20 74 6f 20 70 72  | faults it to pr|
00003020  65 76 65 6e 74 20 74 68  65 0a 63 6f 6d 70 75 74  |event the.comput|
00003030  65 72 20 67 6f 69 6e 67  20 69 6e 74 6f 20 61 20  |er going into a |
00003040  73 65 6d 69 2d 69 6e 66  69 6e 69 74 65 20 6c 6f  |semi-infinite lo|
00003050  6f 70 20 77 68 69 6c 65  20 69 74 20 77 72 69 74  |op while it writ|
00003060  65 73 20 68 75 67 65 20  61 6d 6f 75 6e 74 73 20  |es huge amounts |
00003070  6f 66 0a 64 61 74 61 20  74 6f 20 64 69 73 6b 2e  |of.data to disk.|
00003080  0a 0a 0a 53 79 73 4c 6f  67 5f 4c 6f 67 46 6f 72  |...SysLog_LogFor|
00003090  6d 61 74 74 65 64 20 28  26 34 43 38 38 42 29 0a  |matted (&4C88B).|
000030a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000030b0  2d 2d 2d 0a 52 30 2d 3e  20 6c 6f 67 20 6e 61 6d  |---.R0-> log nam|
000030c0  65 2c 20 6f 72 20 3d 20  73 65 73 73 69 6f 6e 20  |e, or = session |
000030d0  6c 6f 67 20 68 61 6e 64  6c 65 0a 52 31 2d 3e 20  |log handle.R1-> |
000030e0  66 6f 72 6d 61 74 20 73  74 72 69 6e 67 0a 52 32  |format string.R2|
000030f0  20 3d 20 70 72 69 6f 72  69 74 79 0a 52 33 2d 3e  | = priority.R3->|
00003100  20 62 6c 6f 63 6b 20 63  6f 6e 74 61 69 6e 69 6e  | block containin|
00003110  67 20 52 30 2d 52 33 2c  52 38 2d 52 31 32 2c 52  |g R0-R3,R8-R12,R|
00003120  31 34 0a 52 34 2d 52 37  20 3d 20 70 61 72 61 6d  |14.R4-R7 = param|
00003130  65 74 65 72 73 0a 0a 45  76 61 6c 75 61 74 65 73  |eters..Evaluates|
00003140  20 61 20 66 6f 72 6d 61  74 74 65 64 20 73 74 72  | a formatted str|
00003150  69 6e 67 20 75 73 69 6e  67 20 72 65 67 69 73 74  |ing using regist|
00003160  65 72 73 20 52 34 2d 52  37 2c 20 61 6e 64 20 52  |ers R4-R7, and R|
00003170  30 2d 52 33 2c 20 52 38  2d 52 31 32 20 61 6e 64  |0-R3, R8-R12 and|
00003180  0a 52 31 34 20 66 72 6f  6d 20 74 68 65 20 62 6c  |.R14 from the bl|
00003190  6f 63 6b 20 70 61 73 73  65 64 20 69 6e 20 52 33  |ock passed in R3|
000031a0  2c 20 61 6e 64 20 6c 6f  67 73 20 74 68 65 20 72  |, and logs the r|
000031b0  65 73 75 6c 74 2e 20 53  65 65 20 74 68 65 20 73  |esult. See the s|
000031c0  65 63 74 69 6f 6e 0a 22  4c 6f 67 46 6f 72 6d 61  |ection."LogForma|
000031d0  74 74 65 64 22 2c 20 62  65 6c 6f 77 2e 0a 0a 0a  |tted", below....|
000031e0  53 79 73 4c 6f 67 5f 52  65 61 64 45 72 72 6f 72  |SysLog_ReadError|
000031f0  4d 65 73 73 61 67 65 20  28 26 34 43 38 38 43 29  |Message (&4C88C)|
00003200  0a 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.---------------|
00003210  2d 2d 2d 2d 2d 2d 2d 2d  0a 52 30 20 3d 20 65 72  |--------.R0 = er|
00003220  72 6f 72 20 6e 75 6d 62  65 72 0a 65 78 69 74 3a  |ror number.exit:|
00003230  0a 52 30 2d 3e 20 65 72  72 6f 72 20 6d 65 73 73  |.R0-> error mess|
00003240  61 67 65 0a 0a 43 6f 6e  76 65 72 74 73 20 61 6e  |age..Converts an|
00003250  20 65 72 72 6f 72 20 6e  75 6d 62 65 72 20 61 73  | error number as|
00003260  20 72 65 74 75 72 6e 65  64 20 62 79 20 74 68 65  | returned by the|
00003270  20 46 72 65 65 4e 65 74  2f 49 6e 74 65 72 6e 65  | FreeNet/Interne|
00003280  74 2f 65 74 63 20 6d 6f  64 75 6c 65 73 0a 69 6e  |t/etc modules.in|
00003290  74 6f 20 61 20 73 74 72  69 6e 67 20 64 65 73 63  |to a string desc|
000032a0  72 69 62 69 6e 67 20 74  68 65 20 65 72 72 6f 72  |ribing the error|
000032b0  2e 20 65 2e 67 2e 20 53  79 73 4c 6f 67 5f 52 65  |. e.g. SysLog_Re|
000032c0  61 64 45 72 72 6f 72 4d  65 73 73 61 67 65 20 36  |adErrorMessage 6|
000032d0  30 20 77 6f 75 6c 64 0a  72 65 74 75 72 6e 20 22  |0 would.return "|
000032e0  43 6f 6e 6e 65 63 74 69  6f 6e 20 74 69 6d 65 64  |Connection timed|
000032f0  20 6f 75 74 22 2e 0a 0a  0a 53 79 73 4c 6f 67 5f  | out"....SysLog_|
00003300  4c 6f 67 43 6f 6d 70 6c  65 74 65 20 28 26 34 43  |LogComplete (&4C|
00003310  38 38 44 29 0a 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |88D).-----------|
00003320  2d 2d 2d 2d 2d 2d 2d 0a  52 30 2d 3e 20 6c 6f 67  |-------.R0-> log|
00003330  20 6e 61 6d 65 0a 0a 46  6c 75 73 68 65 73 20 74  | name..Flushes t|
00003340  68 65 20 73 70 65 63 69  66 69 65 64 20 6c 6f 67  |he specified log|
00003350  2c 20 61 6e 64 20 64 65  2d 61 6c 6c 6f 63 61 74  |, and de-allocat|
00003360  65 73 20 74 68 65 20 62  75 66 66 65 72 20 61 73  |es the buffer as|
00003370  73 6f 63 69 61 74 65 64  20 77 69 74 68 20 69 74  |sociated with it|
00003380  2e 0a 54 68 69 73 20 73  68 6f 75 6c 64 20 6f 6e  |..This should on|
00003390  6c 79 20 62 65 20 63 61  6c 6c 65 64 20 69 66 20  |ly be called if |
000033a0  74 68 65 20 6c 6f 67 20  69 73 20 64 65 66 69 6e  |the log is defin|
000033b0  69 74 65 6c 79 20 6e 6f  74 20 67 6f 69 6e 67 20  |itely not going |
000033c0  74 6f 20 62 65 20 75 73  65 64 20 66 6f 72 0a 61  |to be used for.a|
000033d0  20 77 68 69 6c 65 20 28  65 2e 67 2e 20 69 66 20  | while (e.g. if |
000033e0  79 6f 75 72 20 61 70 70  6c 69 63 61 74 69 6f 6e  |your application|
000033f0  20 69 73 20 74 68 65 20  6f 6e 6c 79 20 6f 6e 65  | is the only one|
00003400  20 77 68 69 63 68 20 63  61 6e 20 62 65 20 77 72  | which can be wr|
00003410  69 74 69 6e 67 20 74 6f  0a 74 68 65 20 6c 6f 67  |iting to.the log|
00003420  2c 20 61 6e 64 20 69 74  27 73 20 65 78 69 74 69  |, and it's exiti|
00003430  6e 67 29 2e 20 49 66 20  74 68 69 73 20 69 73 6e  |ng). If this isn|
00003440  27 74 20 63 61 6c 6c 65  64 20 65 78 70 6c 69 63  |'t called explic|
00003450  69 74 79 2c 20 53 79 73  4c 6f 67 0a 61 75 74 6f  |ity, SysLog.auto|
00003460  6d 61 74 69 63 61 6c 6c  79 20 64 65 2d 61 6c 6c  |matically de-all|
00003470  6f 63 61 74 65 73 20 74  68 65 20 6c 6f 67 20 62  |ocates the log b|
00003480  75 66 66 65 72 20 61 66  74 65 72 20 74 65 6e 20  |uffer after ten |
00003490  6d 69 6e 75 74 65 73 20  6f 66 20 69 6e 61 63 74  |minutes of inact|
000034a0  69 76 69 74 79 20 69 6e  0a 74 68 65 20 6c 6f 67  |ivity in.the log|
000034b0  2e 0a 0a 0a 53 79 73 4c  6f 67 5f 49 52 51 4d 6f  |....SysLog_IRQMo|
000034c0  64 65 20 28 26 34 43 38  38 45 29 0a 2d 2d 2d 2d  |de (&4C88E).----|
000034d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 52 30 20 3d 20  |----------.R0 = |
000034e0  30 20 74 6f 20 64 69 73  61 62 6c 65 20 49 52 51  |0 to disable IRQ|
000034f0  20 6d 6f 64 65 2c 20 31  20 74 6f 20 65 6e 61 62  | mode, 1 to enab|
00003500  6c 65 20 49 52 51 20 6d  6f 64 65 0a 0a 45 6e 61  |le IRQ mode..Ena|
00003510  62 6c 65 73 20 6f 72 20  64 69 73 61 62 6c 65 73  |bles or disables|
00003520  20 49 52 51 20 6d 6f 64  65 2e 20 53 65 65 20 74  | IRQ mode. See t|
00003530  68 65 20 73 65 63 74 69  6f 6e 20 22 49 52 51 20  |he section "IRQ |
00003540  4d 6f 64 65 22 2c 20 62  65 6c 6f 77 2e 0a 0a 0a  |Mode", below....|
00003550  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003590  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 0a 49 52 51  |============.IRQ|
000035a0  20 4d 6f 64 65 0a 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | Mode.----------|
000035b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000035f0  2d 2d 0a 0a 49 66 20 49  52 51 20 6d 6f 64 65 20  |--..If IRQ mode |
00003600  69 73 20 65 6e 61 62 6c  65 64 2c 20 79 6f 75 20  |is enabled, you |
00003610  6d 61 79 20 63 61 6c 6c  20 53 79 73 4c 6f 67 5f  |may call SysLog_|
00003620  4c 6f 67 4d 65 73 73 61  67 65 2c 20 53 79 73 4c  |LogMessage, SysL|
00003630  6f 67 5f 4c 6f 67 55 6e  73 74 61 6d 70 65 64 2c  |og_LogUnstamped,|
00003640  0a 53 79 73 4c 6f 67 5f  4c 6f 67 44 61 74 61 20  |.SysLog_LogData |
00003650  61 6e 64 20 53 79 73 4c  6f 67 5f 4c 6f 67 46 6f  |and SysLog_LogFo|
00003660  72 6d 61 74 74 65 64 20  66 72 6f 6d 20 77 69 74  |rmatted from wit|
00003670  68 69 6e 20 69 6e 74 65  72 72 75 70 74 20 63 6f  |hin interrupt co|
00003680  64 65 2e 20 4e 6f 72 6d  61 6c 6c 79 0a 79 6f 75  |de. Normally.you|
00003690  20 77 6f 75 6c 64 20 6e  6f 74 20 65 78 70 65 63  | would not expec|
000036a0  74 20 74 6f 20 62 65 20  61 62 6c 65 20 74 6f 20  |t to be able to |
000036b0  63 61 6c 6c 20 74 68 65  73 65 20 53 57 49 73 20  |call these SWIs |
000036c0  69 6e 20 74 68 69 73 20  73 69 74 75 61 74 69 6f  |in this situatio|
000036d0  6e 20 62 65 63 61 75 73  65 0a 74 68 65 20 66 69  |n because.the fi|
000036e0  6c 69 6e 67 20 73 79 73  74 65 6d 20 6d 69 67 68  |ling system migh|
000036f0  74 20 62 65 20 74 68 72  65 61 64 65 64 2e 0a 0a  |t be threaded...|
00003700  49 6e 20 49 52 51 20 6d  6f 64 65 2c 20 74 68 65  |In IRQ mode, the|
00003710  20 62 75 66 66 65 72 73  20 61 72 65 20 6e 6f 74  | buffers are not|
00003720  20 66 6c 75 73 68 65 64  20 69 66 20 74 68 65 79  | flushed if they|
00003730  20 62 65 63 6f 6d 65 20  66 75 6c 6c 2c 20 73 6f  | become full, so|
00003740  20 79 6f 75 20 61 72 65  0a 67 75 61 72 61 6e 74  | you are.guarant|
00003750  65 65 64 20 74 6f 20 62  65 20 61 62 6c 65 20 74  |eed to be able t|
00003760  6f 20 63 61 6c 6c 20 74  68 65 20 53 57 49 73 20  |o call the SWIs |
00003770  77 69 74 68 6f 75 74 20  42 61 64 20 54 68 69 6e  |without Bad Thin|
00003780  67 73 20 68 61 70 70 65  6e 69 6e 67 20 28 61 6c  |gs happening (al|
00003790  6c 0a 74 68 65 79 20 77  69 6c 6c 20 62 65 20 64  |l.they will be d|
000037a0  6f 69 6e 67 20 69 73 20  77 72 69 74 69 6e 67 20  |oing is writing |
000037b0  74 6f 20 6d 65 6d 6f 72  79 29 2e 20 49 66 20 74  |to memory). If t|
000037c0  68 65 20 62 75 66 66 65  72 73 20 61 72 65 20 66  |he buffers are f|
000037d0  75 6c 6c 2c 20 68 6f 77  65 76 65 72 2c 0a 74 68  |ull, however,.th|
000037e0  65 6e 20 6c 6f 67 20 6d  65 73 73 61 67 65 73 20  |en log messages |
000037f0  77 69 6c 6c 20 62 65 20  6c 6f 73 74 2e 0a 0a 49  |will be lost...I|
00003800  66 20 6c 6f 67 20 6d 65  73 73 61 67 65 73 20 61  |f log messages a|
00003810  72 65 20 6c 6f 73 74 20  64 75 65 20 74 6f 20 74  |re lost due to t|
00003820  68 65 20 62 75 66 66 65  72 73 20 62 65 63 6f 6d  |he buffers becom|
00003830  69 6e 67 20 66 75 6c 6c  20 74 68 65 6e 20 61 20  |ing full then a |
00003840  6c 69 6e 65 20 74 6f 0a  74 68 69 73 20 65 66 66  |line to.this eff|
00003850  65 63 74 20 77 69 6c 6c  20 62 65 20 61 64 64 65  |ect will be adde|
00003860  64 20 74 6f 20 74 68 65  20 6c 6f 67 20 61 74 20  |d to the log at |
00003870  74 68 65 20 6e 65 78 74  20 6f 70 70 6f 72 74 75  |the next opportu|
00003880  6e 69 74 79 2e 0a 0a 44  6f 20 74 72 79 20 74 6f  |nity...Do try to|
00003890  20 65 6e 73 75 72 65 20  74 68 61 74 20 79 6f 75  | ensure that you|
000038a0  20 63 61 6c 6c 20 53 79  73 4c 6f 67 5f 49 52 51  | call SysLog_IRQ|
000038b0  4d 6f 64 65 20 74 6f 20  64 69 73 61 62 6c 65 20  |Mode to disable |
000038c0  49 52 51 20 6d 6f 64 65  20 77 68 65 6e 0a 79 6f  |IRQ mode when.yo|
000038d0  75 20 61 72 65 20 65 78  69 74 69 6e 67 20 74 68  |u are exiting th|
000038e0  65 20 69 6e 74 65 72 72  75 70 74 20 63 6f 64 65  |e interrupt code|
000038f0  2c 20 6f 74 68 65 72 77  69 73 65 20 6f 74 68 65  |, otherwise othe|
00003900  72 20 61 70 70 6c 69 63  61 74 69 6f 6e 73 20 6d  |r applications m|
00003910  61 79 20 68 61 76 65 0a  74 68 65 69 72 20 6c 6f  |ay have.their lo|
00003920  67 20 6d 65 73 73 61 67  65 73 20 6c 6f 73 74 20  |g messages lost |
00003930  75 6e 6e 65 63 65 73 73  61 72 69 6c 79 2e 20 53  |unnecessarily. S|
00003940  79 73 4c 6f 67 20 6d 61  69 6e 74 61 69 6e 73 20  |ysLog maintains |
00003950  61 20 63 6f 75 6e 74 65  72 20 6f 66 20 68 6f 77  |a counter of how|
00003960  0a 6d 61 6e 20 74 69 6d  65 73 20 49 52 51 20 6d  |.man times IRQ m|
00003970  6f 64 65 20 68 61 73 20  62 65 65 6e 20 65 6e 61  |ode has been ena|
00003980  62 6c 65 64 20 61 6e 64  20 64 69 73 61 62 6c 65  |bled and disable|
00003990  64 2c 20 61 6e 64 20 6f  6e 6c 79 20 67 65 6e 75  |d, and only genu|
000039a0  69 6e 65 6c 79 0a 64 69  73 61 62 6c 65 73 20 69  |inely.disables i|
000039b0  74 20 77 68 65 6e 20 74  68 65 20 63 6f 75 6e 74  |t when the count|
000039c0  65 72 20 69 73 20 7a 65  72 6f 2e 0a 0a 53 79 73  |er is zero...Sys|
000039d0  4c 6f 67 5f 47 65 74 4c  6f 67 4c 65 76 65 6c 2c  |Log_GetLogLevel,|
000039e0  20 53 79 73 4c 6f 67 5f  49 6e 64 65 6e 74 2c 20  | SysLog_Indent, |
000039f0  53 79 73 4c 6f 67 5f 55  6e 49 6e 64 65 6e 74 2c  |SysLog_UnIndent,|
00003a00  20 53 79 73 4c 6f 67 5f  4e 6f 49 6e 64 65 6e 74  | SysLog_NoIndent|
00003a10  20 61 6e 64 0a 53 79 73  4c 6f 67 5f 52 65 61 64  | and.SysLog_Read|
00003a20  45 72 72 6f 72 4d 65 73  73 61 67 65 20 6d 61 79  |ErrorMessage may|
00003a30  20 61 6c 77 61 79 73 20  62 65 20 63 61 6c 6c 65  | always be calle|
00003a40  64 20 66 72 6f 6d 20 69  6e 74 65 72 72 75 70 74  |d from interrupt|
00003a50  20 63 6f 64 65 2e 20 4f  74 68 65 72 0a 53 79 73  | code. Other.Sys|
00003a60  4c 6f 67 20 53 57 49 73  20 6d 61 79 20 6e 65 76  |Log SWIs may nev|
00003a70  65 72 20 62 65 20 63 61  6c 6c 65 64 20 66 72 6f  |er be called fro|
00003a80  6d 20 69 6e 74 65 72 72  75 70 74 20 63 6f 64 65  |m interrupt code|
00003a90  2e 0a 0a 0a 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |....============|
00003aa0  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00003ae0  0a 4c 6f 67 46 6f 72 6d  61 74 74 65 64 0a 2d 2d  |.LogFormatted.--|
00003af0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003b30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0a 0a 53 57 49 20  |----------..SWI |
00003b40  53 79 73 4c 6f 67 5f 4c  6f 67 46 6f 72 6d 61 74  |SysLog_LogFormat|
00003b50  74 65 64 20 70 72 6f 76  69 64 65 73 20 43 20 22  |ted provides C "|
00003b60  70 72 69 6e 74 66 22 2d  73 74 79 6c 65 20 66 75  |printf"-style fu|
00003b70  6e 63 74 69 6f 6e 61 6c  69 74 79 20 66 6f 72 0a  |nctionality for.|
00003b80  61 73 73 65 6d 62 6c 65  72 20 70 72 6f 67 72 61  |assembler progra|
00003b90  6d 6d 65 72 73 2e 20 41  20 66 6f 72 6d 61 74 20  |mmers. A format |
00003ba0  73 74 72 69 6e 67 20 69  73 20 70 61 73 73 65 64  |string is passed|
00003bb0  20 69 6e 20 52 31 2c 20  77 68 69 63 68 20 69 73  | in R1, which is|
00003bc0  20 61 20 74 65 6d 70 6c  61 74 65 0a 66 6f 72 20  | a template.for |
00003bd0  74 68 65 20 6f 75 74 70  75 74 2e 20 54 68 65 20  |the output. The |
00003be0  73 74 72 69 6e 67 20 69  73 20 63 6f 70 69 65 64  |string is copied|
00003bf0  20 64 69 72 65 63 74 6c  79 20 74 6f 20 74 68 65  | directly to the|
00003c00  20 6f 75 74 70 75 74 2c  20 65 78 63 65 70 74 20  | output, except |
00003c10  66 6f 72 20 27 25 27 0a  63 68 61 72 61 63 74 65  |for '%'.characte|
00003c20  72 73 2c 20 77 68 69 63  68 20 69 6e 73 65 72 74  |rs, which insert|
00003c30  73 20 61 20 73 74 72 69  6e 67 20 63 61 6c 63 75  |s a string calcu|
00003c40  6c 61 74 65 64 20 77 68  65 6e 20 74 68 65 20 53  |lated when the S|
00003c50  57 49 20 69 73 20 63 61  6c 6c 65 64 3a 0a 0a 20  |WI is called:.. |
00003c60  20 20 20 20 20 20 20 25  25 20 20 20 20 20 20 2d  |       %%      -|
00003c70  20 74 68 65 20 6c 69 74  65 72 61 6c 20 27 25 27  | the literal '%'|
00003c80  20 63 68 61 72 61 63 74  65 72 0a 20 20 20 20 20  | character.     |
00003c90  20 20 20 25 3c 72 65 67  3e 61 20 2d 20 74 68 65  |   %<reg>a - the|
00003ca0  20 6e 65 74 77 6f 72 6b  2d 62 79 74 65 2d 6f 72  | network-byte-or|
00003cb0  64 65 72 65 64 20 49 50  20 61 64 64 72 65 73 73  |dered IP address|
00003cc0  20 69 6e 20 72 65 67 69  73 74 65 72 20 3c 72 65  | in register <re|
00003cd0  67 3e 0a 20 20 20 20 20  20 20 20 25 3c 72 65 67  |g>.        %<reg|
00003ce0  3e 63 20 2d 20 74 68 65  20 63 68 61 72 61 63 74  |>c - the charact|
00003cf0  65 72 20 69 6e 20 72 65  67 69 73 74 65 72 20 3c  |er in register <|
00003d00  72 65 67 3e 0a 20 20 20  20 20 20 20 20 25 3c 72  |reg>.        %<r|
00003d10  65 67 3e 64 20 2d 20 74  68 65 20 73 69 67 6e 65  |eg>d - the signe|
00003d20  64 20 64 65 63 69 6d 61  6c 20 69 6e 74 65 67 65  |d decimal intege|
00003d30  72 20 69 6e 20 72 65 67  69 73 74 65 72 20 3c 72  |r in register <r|
00003d40  65 67 3e 0a 20 20 20 20  20 20 20 20 25 3c 72 65  |eg>.        %<re|
00003d50  67 3e 65 20 2d 20 74 68  65 20 6d 65 73 73 61 67  |g>e - the messag|
00003d60  65 20 66 6f 72 20 74 68  65 20 46 72 65 65 4e 65  |e for the FreeNe|
00003d70  74 20 65 72 72 6f 72 20  6e 75 6d 62 65 72 20 69  |t error number i|
00003d80  6e 20 72 65 67 69 73 74  65 72 20 3c 72 65 67 3e  |n register <reg>|
00003d90  0a 20 20 20 20 20 20 20  20 25 3c 72 65 67 3e 66  |.        %<reg>f|
00003da0  20 2d 20 74 68 65 20 66  69 6c 65 6e 61 6d 65 20  | - the filename |
00003db0  6f 66 20 74 68 65 20 66  69 6c 65 20 68 61 6e 64  |of the file hand|
00003dc0  6c 65 20 69 6e 20 72 65  67 69 73 74 65 72 20 3c  |le in register <|
00003dd0  72 65 67 3e 0a 20 20 20  20 20 20 20 20 25 3c 72  |reg>.        %<r|
00003de0  65 67 3e 70 20 2d 20 74  68 65 20 6f 62 6a 65 63  |eg>p - the objec|
00003df0  74 20 70 6f 69 6e 74 65  64 20 74 6f 20 62 79 20  |t pointed to by |
00003e00  72 65 67 69 73 74 65 72  20 3c 72 65 67 3e 0a 20  |register <reg>. |
00003e10  20 20 20 20 20 20 20 25  3c 72 65 67 3e 73 20 2d  |       %<reg>s -|
00003e20  20 74 68 65 20 63 6f 6e  74 72 6f 6c 2d 74 65 72  | the control-ter|
00003e30  6d 69 6e 61 74 65 64 20  73 74 72 69 6e 67 20 70  |minated string p|
00003e40  6f 69 6e 74 65 64 20 74  6f 20 62 79 20 72 65 67  |ointed to by reg|
00003e50  69 73 74 65 72 20 3c 72  65 67 3e 0a 20 20 20 20  |ister <reg>.    |
00003e60  20 20 20 20 25 3c 72 65  67 3e 78 20 2d 20 74 68  |    %<reg>x - th|
00003e70  65 20 75 6e 73 69 67 6e  65 64 20 68 65 78 61 64  |e unsigned hexad|
00003e80  65 63 69 6d 61 6c 20 69  6e 74 65 67 65 72 20 69  |ecimal integer i|
00003e90  6e 20 72 65 67 69 73 74  65 72 20 3c 72 65 67 3e  |n register <reg>|
00003ea0  0a 20 20 20 20 20 20 20  20 25 3c 72 65 67 3e 7a  |.        %<reg>z|
00003eb0  20 2d 20 74 68 65 20 7a  65 72 6f 2d 74 65 72 6d  | - the zero-term|
00003ec0  69 6e 61 74 65 64 20 73  74 72 69 6e 67 20 70 6f  |inated string po|
00003ed0  69 6e 74 65 64 20 74 6f  20 62 79 20 72 65 67 69  |inted to by regi|
00003ee0  73 74 65 72 20 3c 72 65  67 3e 0a 0a 20 20 20 77  |ster <reg>..   w|
00003ef0  68 65 72 65 20 3c 72 65  67 3e 20 69 73 20 61 20  |here <reg> is a |
00003f00  6e 75 6d 62 65 72 20 77  68 69 63 68 20 63 61 6e  |number which can|
00003f10  20 62 65 20 61 6e 79 20  6f 66 20 30 20 74 6f 20  | be any of 0 to |
00003f20  31 32 20 6f 72 20 31 34  2e 0a 0a 4e 6f 74 65 20  |12 or 14...Note |
00003f30  74 68 61 74 20 74 68 65  20 25 3c 72 65 67 3e 70  |that the %<reg>p|
00003f40  20 74 79 70 65 20 6d 75  73 74 20 62 65 20 66 6f  | type must be fo|
00003f50  6c 6c 6f 77 65 64 20 62  79 20 61 6e 6f 74 68 65  |llowed by anothe|
00003f60  72 20 74 79 70 65 20 69  6e 64 69 63 61 74 6f 72  |r type indicator|
00003f70  2e 20 46 6f 72 0a 65 78  61 6d 70 6c 65 2c 20 74  |. For.example, t|
00003f80  6f 20 6c 6f 67 20 61 20  63 68 61 72 61 63 74 65  |o log a characte|
00003f90  72 20 70 6f 69 6e 74 65  64 20 74 6f 20 62 79 20  |r pointed to by |
00003fa0  72 65 67 69 73 74 65 72  20 52 33 2c 20 75 73 65  |register R3, use|
00003fb0  20 22 25 33 70 63 22 2e  20 4d 6f 72 65 20 74 68  | "%3pc". More th|
00003fc0  61 6e 0a 6f 6e 65 20 27  70 27 20 63 61 6e 20 62  |an.one 'p' can b|
00003fd0  65 20 75 73 65 64 20 74  6f 20 69 6e 64 69 63 61  |e used to indica|
00003fe0  74 65 20 6d 6f 72 65 20  74 68 61 6e 20 6f 6e 65  |te more than one|
00003ff0  20 6c 65 76 65 6c 20 6f  66 20 69 6e 64 69 72 65  | level of indire|
00004000  63 74 69 6f 6e 2e 0a 0a  4e 75 6c 6c 20 70 6f 69  |ction...Null poi|
00004010  6e 74 65 72 73 20 61 72  65 20 65 78 70 6c 69 63  |nters are explic|
00004020  69 74 6c 79 20 63 68 65  63 6b 65 64 20 66 6f 72  |itly checked for|
00004030  20 77 68 65 72 65 76 65  72 20 75 73 65 64 2c 20  | wherever used, |
00004040  61 6e 64 20 74 68 65 20  73 74 72 69 6e 67 0a 22  |and the string."|
00004050  28 6e 75 6c 6c 29 22 20  69 73 20 6c 6f 67 67 65  |(null)" is logge|
00004060  64 20 69 6e 20 70 6c 61  63 65 20 6f 66 20 77 68  |d in place of wh|
00004070  61 74 65 76 65 72 20 73  68 6f 75 6c 64 20 68 61  |atever should ha|
00004080  76 65 20 62 65 65 6e 20  6f 75 74 70 75 74 2e 20  |ve been output. |
00004090  48 65 6e 63 65 20 69 74  0a 69 73 20 65 78 70 6c  |Hence it.is expl|
000040a0  69 63 69 74 79 20 64 65  66 69 6e 65 64 20 74 68  |icity defined th|
000040b0  61 74 20 69 74 20 69 73  20 73 61 66 65 20 74 6f  |at it is safe to|
000040c0  20 61 6c 6c 6f 77 20 6e  75 6c 6c 20 70 6f 69 6e  | allow null poin|
000040d0  74 65 72 73 20 74 6f 20  62 65 20 69 6e 0a 72 65  |ters to be in.re|
000040e0  67 69 73 74 65 72 73 20  75 73 65 64 20 62 79 20  |gisters used by |
000040f0  74 68 65 20 66 6f 72 6d  61 74 20 73 74 72 69 6e  |the format strin|
00004100  67 2e 0a 0a 52 65 67 69  73 74 65 72 73 20 52 34  |g...Registers R4|
00004110  2d 52 37 20 61 72 65 20  74 61 6b 65 6e 20 64 69  |-R7 are taken di|
00004120  72 65 63 74 6c 79 20 66  72 6f 6d 20 74 68 65 20  |rectly from the |
00004130  72 65 67 69 73 74 65 72  73 20 70 61 73 73 65 64  |registers passed|
00004140  20 74 6f 20 74 68 65 20  53 57 49 2e 0a 52 65 67  | to the SWI..Reg|
00004150  69 73 74 65 72 73 20 52  30 2d 52 33 2c 20 52 38  |isters R0-R3, R8|
00004160  2d 52 31 32 20 61 6e 64  20 52 31 34 20 61 72 65  |-R12 and R14 are|
00004170  20 74 61 6b 65 6e 20 66  72 6f 6d 20 74 68 65 20  | taken from the |
00004180  62 6c 6f 63 6b 20 70 61  73 73 65 64 20 69 6e 20  |block passed in |
00004190  52 33 2e 0a 0a 49 74 20  69 73 20 65 78 70 65 63  |R3...It is expec|
000041a0  74 65 64 20 74 68 61 74  20 74 68 69 73 20 53 57  |ted that this SW|
000041b0  49 20 77 6f 75 6c 64 20  62 65 20 70 61 63 6b 61  |I would be packa|
000041c0  67 65 64 20 69 6e 20 61  20 6d 61 63 72 6f 20 69  |ged in a macro i|
000041d0  6e 20 79 6f 75 72 20 61  73 73 65 6d 62 6c 65 72  |n your assembler|
000041e0  0a 73 6f 75 72 63 65 20  63 6f 64 65 2e 20 46 6f  |.source code. Fo|
000041f0  72 20 65 78 61 6d 70 6c  65 3a 0a 0a 2e 2e 2e 0a  |r example:......|
00004200  2e 73 74 72 69 63 6d 70  0a 20 20 46 4e 6c 6f 67  |.stricmp.  FNlog|
00004210  66 28 22 73 74 72 69 63  6d 70 3a 20 63 6f 6d 70  |f("stricmp: comp|
00004220  61 72 69 6e 67 20 25 30  7a 20 61 6e 64 20 25 31  |aring %0z and %1|
00004230  7a 22 2c 32 30 30 29 0a  2e 2e 2e 0a 0a 44 45 46  |z",200)......DEF|
00004240  20 46 4e 6c 6f 67 66 28  74 24 2c 70 25 29 0a 20  | FNlogf(t$,p%). |
00004250  20 5b 4f 50 54 20 70 0a  20 20 20 20 53 54 4d 46  | [OPT p.    STMF|
00004260  44 20 20 20 52 31 33 21  2c 7b 52 30 2d 52 33 2c  |D   R13!,{R0-R3,|
00004270  52 38 2d 52 31 32 2c 52  31 34 7d 0a 20 20 20 20  |R8-R12,R14}.    |
00004280  41 44 52 20 20 20 20 20  52 30 2c 74 78 74 5f 6c  |ADR     R0,txt_l|
00004290  6f 67 6e 61 6d 65 0a 20  20 20 20 41 44 44 20 20  |ogname.    ADD  |
000042a0  20 20 20 52 31 2c 52 31  35 2c 23 31 32 0a 20 20  |   R1,R15,#12.  |
000042b0  20 20 4d 4f 56 20 20 20  20 20 52 32 2c 23 70 25  |  MOV     R2,#p%|
000042c0  0a 20 20 20 20 4d 4f 56  20 20 20 20 20 52 33 2c  |.    MOV     R3,|
000042d0  52 31 33 0a 20 20 20 20  53 57 49 20 20 20 20 20  |R13.    SWI     |
000042e0  22 53 79 73 4c 6f 67 5f  4c 6f 67 46 6f 72 6d 61  |"SysLog_LogForma|
000042f0  74 74 65 64 22 0a 20 20  20 20 42 20 20 20 20 20  |tted".    B     |
00004300  20 20 50 25 2b 28 4c 45  4e 74 24 2b 38 29 41 4e  |  P%+(LENt$+8)AN|
00004310  44 4e 4f 54 33 0a 20 20  20 20 45 51 55 53 20 20  |DNOT3.    EQUS  |
00004320  20 20 74 24 2b 53 54 52  49 4e 47 24 28 34 2d 28  |  t$+STRING$(4-(|
00004330  4c 45 4e 74 24 41 4e 44  33 29 2c 43 48 52 24 30  |LENt$AND3),CHR$0|
00004340  29 0a 20 20 20 20 4c 44  4d 46 44 20 20 20 52 31  |).    LDMFD   R1|
00004350  33 21 2c 7b 52 30 2d 52  33 2c 52 38 2d 52 31 32  |3!,{R0-R3,R8-R12|
00004360  2c 52 31 34 7d 0a 20 20  5d 0a 3d 70 0a 0a 6f 72  |,R14}.  ].=p..or|
00004370  20 74 68 65 20 4f 62 6a  41 73 6d 20 65 71 75 69  | the ObjAsm equi|
00004380  76 61 6c 65 6e 74 3a 0a  0a 20 20 20 20 20 20 20  |valent:..       |
00004390  20 4d 41 43 52 4f 0a 20  20 20 20 20 20 20 20 4c  | MACRO.        L|
000043a0  4f 47 46 20 20 20 20 24  74 2c 24 70 0a 0a 20 20  |OGF    $t,$p..  |
000043b0  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 52 31  |      STMFD   R1|
000043c0  33 21 2c 7b 52 30 2d 52  33 2c 52 38 2d 52 31 32  |3!,{R0-R3,R8-R12|
000043d0  2c 52 31 34 7d 0a 20 20  20 20 20 20 20 20 41 44  |,R14}.        AD|
000043e0  52 20 20 20 20 20 52 30  2c 74 78 74 5f 6c 6f 67  |R     R0,txt_log|
000043f0  6e 61 6d 65 0a 20 20 20  20 20 20 20 20 41 44 52  |name.        ADR|
00004400  20 20 20 20 20 52 31 2c  25 66 74 39 30 0a 20 20  |     R1,%ft90.  |
00004410  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 52 32  |      MOV     R2|
00004420  2c 23 24 70 0a 20 20 20  20 20 20 20 20 4d 4f 56  |,#$p.        MOV|
00004430  20 20 20 20 20 52 33 2c  52 31 33 0a 20 20 20 20  |     R3,R13.    |
00004440  20 20 20 20 53 57 49 20  20 20 20 20 53 79 73 4c  |    SWI     SysL|
00004450  6f 67 5f 4c 6f 67 46 6f  72 6d 61 74 74 65 64 0a  |og_LogFormatted.|
00004460  20 20 20 20 20 20 20 20  42 20 20 20 20 20 20 20  |        B       |
00004470  25 66 74 39 31 0a 39 30  0a 20 20 20 20 20 20 20  |%ft91.90.       |
00004480  20 3d 20 20 20 20 20 20  20 22 24 74 22 2c 30 0a  | =       "$t",0.|
00004490  20 20 20 20 20 20 20 20  41 4c 49 47 4e 0a 39 31  |        ALIGN.91|
000044a0  20 20 20 20 20 20 4c 44  4d 46 44 20 20 20 52 31  |      LDMFD   R1|
000044b0  33 21 2c 7b 52 30 2d 52  33 2c 52 38 2d 52 31 32  |3!,{R0-R3,R8-R12|
000044c0  2c 52 31 34 7d 0a 20 20  20 20 20 20 20 20 4d 45  |,R14}.        ME|
000044d0  4e 44 0a 0a 2e 2e 2e 0a  73 74 72 69 63 6d 70 20  |ND......stricmp |
000044e0  52 4f 55 54 0a 20 20 20  20 20 20 20 20 4c 4f 47  |ROUT.        LOG|
000044f0  46 20 20 20 20 22 73 74  72 69 63 6d 70 3a 20 63  |F    "stricmp: c|
00004500  6f 6d 70 61 72 69 6e 67  20 25 30 7a 20 61 6e 64  |omparing %0z and|
00004510  20 25 31 7a 22 2c 32 30  30 0a 2e 2e 2e 0a 0a 0a  | %1z",200.......|
00004520  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00004560  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 0a 55 73 69  |============.Usi|
00004570  6e 67 20 53 79 73 4c 6f  67 20 66 72 6f 6d 20 43  |ng SysLog from C|
00004580  20 70 72 6f 67 72 61 6d  73 0a 2d 2d 2d 2d 2d 2d  | programs.------|
00004590  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000045d0  2d 2d 2d 2d 2d 2d 0a 0a  54 6f 20 6d 61 6b 65 20  |------..To make |
000045e0  53 79 73 4c 6f 67 20 65  61 73 79 20 74 6f 20 75  |SysLog easy to u|
000045f0  73 65 20 66 72 6f 6d 20  43 20 70 72 6f 67 72 61  |se from C progra|
00004600  6d 73 2c 20 49 20 68 61  76 65 20 77 72 69 74 74  |ms, I have writt|
00004610  65 6e 20 61 6e 20 41 50  43 53 20 76 65 6e 65 65  |en an APCS venee|
00004620  72 0a 66 6f 72 20 74 68  65 20 6d 6f 64 75 6c 65  |r.for the module|
00004630  2e 20 54 68 69 73 20 74  61 6b 65 73 20 74 68 65  |. This takes the|
00004640  20 66 6f 72 6d 20 6f 66  20 61 20 22 73 79 73 6c  | form of a "sysl|
00004650  6f 67 2e 68 22 20 68 65  61 64 65 72 20 66 69 6c  |og.h" header fil|
00004660  65 20 77 68 69 63 68 20  79 6f 75 0a 73 68 6f 75  |e which you.shou|
00004670  6c 64 20 23 69 6e 63 6c  75 64 65 20 66 72 6f 6d  |ld #include from|
00004680  20 79 6f 75 72 20 43 20  73 6f 75 72 63 65 2c 20  | your C source, |
00004690  61 6e 64 20 61 20 22 73  79 73 6c 6f 67 2e 6f 22  |and a "syslog.o"|
000046a0  20 6f 62 6a 65 63 74 20  66 69 6c 65 20 77 68 69  | object file whi|
000046b0  63 68 20 79 6f 75 0a 73  68 6f 75 6c 64 20 6c 69  |ch you.should li|
000046c0  6e 6b 20 79 6f 75 72 20  70 72 6f 67 72 61 6d 20  |nk your program |
000046d0  77 69 74 68 2e 0a 0a 54  68 65 72 65 20 61 72 65  |with...There are|
000046e0  20 74 77 6f 20 63 61 6c  6c 73 20 66 6f 72 20 65  | two calls for e|
000046f0  61 63 68 20 53 57 49 2c  20 6f 6e 65 20 77 68 69  |ach SWI, one whi|
00004700  63 68 20 75 73 65 73 20  74 68 65 20 6e 6f 6e 2d  |ch uses the non-|
00004710  58 20 66 6f 72 6d 20 61  6e 64 20 6f 6e 65 0a 77  |X form and one.w|
00004720  68 69 63 68 20 75 73 65  73 20 74 68 65 20 58 20  |hich uses the X |
00004730  66 6f 72 6d 20 61 6e 64  20 72 65 74 75 72 6e 73  |form and returns|
00004740  20 61 20 5f 6b 65 72 6e  65 6c 5f 6f 73 65 72 72  | a _kernel_oserr|
00004750  6f 72 20 2a 2e 20 54 68  65 20 6e 6f 6e 2d 58 20  |or *. The non-X |
00004760  66 6f 72 6d 73 20 61 72  65 0a 67 65 6e 65 72 61  |forms are.genera|
00004770  6c 6c 79 20 6e 69 63 65  72 20 61 73 20 76 61 6c  |lly nicer as val|
00004780  75 65 73 20 63 61 6e 20  62 65 20 72 65 74 75 72  |ues can be retur|
00004790  6e 65 64 20 69 6e 20 74  68 65 20 75 73 75 61 6c  |ned in the usual|
000047a0  20 6d 61 6e 6e 65 72 2c  20 72 61 74 68 65 72 20  | manner, rather |
000047b0  74 68 61 6e 0a 68 61 76  69 6e 67 20 74 6f 20 70  |than.having to p|
000047c0  61 73 73 20 61 20 70 6f  69 6e 74 65 72 20 74 6f  |ass a pointer to|
000047d0  20 61 20 6c 6f 63 61 74  69 6f 6e 20 74 6f 20 62  | a location to b|
000047e0  65 20 66 69 6c 6c 65 64  20 69 6e 20 77 69 74 68  |e filled in with|
000047f0  20 74 68 65 20 72 65 74  75 72 6e 20 63 6f 64 65  | the return code|
00004800  2e 0a 49 20 77 6f 75 6c  64 20 73 75 67 67 65 73  |..I would sugges|
00004810  74 20 6f 6e 6c 79 20 75  73 69 6e 67 20 74 68 65  |t only using the|
00004820  20 58 20 66 6f 72 6d 73  20 77 68 65 6e 20 79 6f  | X forms when yo|
00004830  75 20 61 62 73 6f 6c 75  74 65 6c 79 20 6d 75 73  |u absolutely mus|
00004840  74 20 2d 20 69 2e 65 2e  20 69 6e 0a 6d 6f 64 75  |t - i.e. in.modu|
00004850  6c 65 20 63 6f 64 65 2c  20 65 74 63 2e 0a 0a 54  |le code, etc...T|
00004860  68 65 72 65 27 73 20 61  6c 73 6f 20 61 20 62 6f  |here's also a bo|
00004870  6e 75 73 20 66 75 6e 63  74 69 6f 6e 20 22 73 79  |nus function "sy|
00004880  73 6c 6f 67 66 22 20 28  61 6e 64 20 22 78 73 79  |slogf" (and "xsy|
00004890  73 6c 6f 67 66 22 29 20  77 68 69 63 68 20 69 73  |slogf") which is|
000048a0  20 6c 69 6b 65 0a 22 70  72 69 6e 74 66 22 20 65  | like."printf" e|
000048b0  78 63 65 70 74 20 69 74  20 6f 75 74 70 75 74 73  |xcept it outputs|
000048c0  20 74 6f 20 74 68 65 20  6c 6f 67 2e 20 54 68 65  | to the log. The|
000048d0  20 66 69 72 73 74 20 74  77 6f 20 61 72 67 75 6d  | first two argum|
000048e0  65 6e 74 73 20 61 72 65  20 74 68 65 0a 6c 6f 67  |ents are the.log|
000048f0  6e 61 6d 65 20 61 6e 64  20 70 72 69 6f 72 69 74  |name and priorit|
00004900  79 2c 20 61 6e 64 20 74  68 65 20 72 65 73 74 20  |y, and the rest |
00004910  61 72 65 20 74 68 65 20  75 73 75 61 6c 20 70 72  |are the usual pr|
00004920  69 6e 74 66 20 61 72 67  75 6d 65 6e 74 73 20 28  |intf arguments (|
00004930  69 2e 65 2e 0a 74 68 65  20 66 6f 72 6d 61 74 20  |i.e..the format |
00004940  73 74 72 69 6e 67 20 66  6f 6c 6c 6f 77 65 64 20  |string followed |
00004950  62 79 20 61 20 76 61 72  69 61 62 6c 65 20 6e 75  |by a variable nu|
00004960  6d 62 65 72 20 6f 66 20  61 72 67 75 6d 65 6e 74  |mber of argument|
00004970  73 29 2e 0a 0a 4e 6f 74  65 20 74 68 61 74 20 61  |s)...Note that a|
00004980  20 74 65 6d 70 6f 72 61  72 79 20 62 75 66 66 65  | temporary buffe|
00004990  72 20 69 73 20 75 73 65  64 20 74 6f 20 68 6f 6c  |r is used to hol|
000049a0  64 20 74 68 65 20 73 74  72 69 6e 67 20 62 65 66  |d the string bef|
000049b0  6f 72 65 20 69 74 20 69  73 20 70 61 73 73 65 64  |ore it is passed|
000049c0  0a 74 6f 20 74 68 65 20  53 79 73 4c 6f 67 20 6d  |.to the SysLog m|
000049d0  6f 64 75 6c 65 20 61 6e  64 20 2a 54 48 49 53 20  |odule and *THIS |
000049e0  42 55 46 46 45 52 20 49  53 20 4f 4e 4c 59 20 31  |BUFFER IS ONLY 1|
000049f0  30 32 34 20 42 59 54 45  53 20 4c 4f 4e 47 2a 2e  |024 BYTES LONG*.|
00004a00  20 69 2e 65 2e 20 79 6f  75 0a 6d 75 73 74 20 65  | i.e. you.must e|
00004a10  6e 73 75 72 65 20 74 68  61 74 20 79 6f 75 72 20  |nsure that your |
00004a20  66 6f 72 6d 61 74 20 73  74 72 69 6e 67 20 63 61  |format string ca|
00004a30  6e 6e 6f 74 20 65 76 65  72 20 70 72 6f 64 75 63  |nnot ever produc|
00004a40  65 20 6d 6f 72 65 20 74  68 61 6e 20 31 30 32 34  |e more than 1024|
00004a50  20 62 79 74 65 73 0a 6f  66 20 6f 75 74 70 75 74  | bytes.of output|
00004a60  2e 20 54 68 69 73 20 69  73 20 65 73 70 65 63 69  |. This is especi|
00004a70  61 6c 6c 79 20 69 6d 70  6f 72 74 61 6e 74 20 69  |ally important i|
00004a80  6e 20 6e 65 74 77 6f 72  6b 69 6e 67 20 73 6f 66  |n networking sof|
00004a90  74 77 61 72 65 20 77 68  65 72 65 20 74 68 65 0a  |tware where the.|
00004aa0  69 6e 70 75 74 20 6d 61  79 20 62 65 20 63 6f 6d  |input may be com|
00004ab0  69 6e 67 20 66 72 6f 6d  20 61 20 42 61 64 20 4d  |ing from a Bad M|
00004ac0  69 73 63 72 65 61 6e 74  20 77 68 6f 20 69 73 20  |iscreant who is |
00004ad0  74 72 79 69 6e 67 20 74  6f 20 68 61 63 6b 20 69  |trying to hack i|
00004ae0  6e 74 6f 20 6f 72 20 63  72 61 73 68 0a 79 6f 75  |nto or crash.you|
00004af0  72 20 6d 61 63 68 69 6e  65 2e 0a 0a 54 68 65 20  |r machine...The |
00004b00  4f 62 6a 41 73 6d 20 73  6f 75 72 63 65 20 74 6f  |ObjAsm source to|
00004b10  20 74 68 65 20 76 65 6e  65 65 72 20 6f 62 6a 65  | the veneer obje|
00004b20  63 74 20 66 69 6c 65 20  69 73 20 70 72 6f 76 69  |ct file is provi|
00004b30  64 65 64 2e 20 49 66 20  79 6f 75 20 6d 61 6b 65  |ded. If you make|
00004b40  20 61 6e 79 0a 63 68 61  6e 67 65 73 20 77 68 69  | any.changes whi|
00004b50  63 68 20 79 6f 75 20 74  68 69 6e 6b 20 70 65 6f  |ch you think peo|
00004b60  70 6c 65 20 6d 69 67 68  74 20 66 69 6e 64 20 75  |ple might find u|
00004b70  73 65 66 75 6c 2c 20 6f  72 20 79 6f 75 20 66 69  |seful, or you fi|
00004b80  6e 64 20 61 6e 79 20 62  75 67 73 2c 0a 70 6c 65  |nd any bugs,.ple|
00004b90  61 73 65 20 65 2d 6d 61  69 6c 20 6d 65 20 61 6e  |ase e-mail me an|
00004ba0  64 20 74 65 6c 6c 20 6d  65 20 61 62 6f 75 74 20  |d tell me about |
00004bb0  69 74 2e 0a 0a 54 68 61  6e 6b 73 20 67 6f 20 74  |it...Thanks go t|
00004bc0  6f 20 53 74 65 77 61 72  74 20 42 72 6f 64 69 65  |o Stewart Brodie|
00004bd0  20 66 6f 72 20 61 73 73  69 73 74 61 6e 63 65 20  | for assistance |
00004be0  77 69 74 68 20 76 73 70  72 69 6e 74 66 20 3b 2d  |with vsprintf ;-|
00004bf0  29 2e 0a 0a 0a 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |)....===========|
00004c00  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00004c40  3d 0a 4f 70 74 69 6f 6e  73 0a 2d 2d 2d 2d 2d 2d  |=.Options.------|
00004c50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00004c90  2d 2d 2d 2d 2d 2d 0a 0a  54 68 65 20 6f 70 74 69  |------..The opti|
00004ca0  6f 6e 73 20 66 69 6c 65  20 69 73 20 73 74 6f 72  |ons file is stor|
00004cb0  65 64 20 61 73 20 21 53  79 73 4c 6f 67 2e 4f 70  |ed as !SysLog.Op|
00004cc0  74 69 6f 6e 73 2e 20 45  61 63 68 20 6c 69 6e 65  |tions. Each line|
00004cd0  20 6f 66 20 74 68 65 20  6f 70 74 69 6f 6e 73 20  | of the options |
00004ce0  66 69 6c 65 0a 73 70 65  63 69 66 69 65 73 20 74  |file.specifies t|
00004cf0  68 65 20 6f 70 74 69 6f  6e 73 20 66 6f 72 20 61  |he options for a|
00004d00  20 73 69 6e 67 6c 65 20  6c 6f 67 2e 20 54 68 69  | single log. Thi|
00004d10  73 20 6c 69 6e 65 20 69  73 20 6f 66 20 74 68 65  |s line is of the|
00004d20  20 66 6f 72 6d 61 74 3a  0a 20 20 20 20 3c 6c 6f  | format:.    <lo|
00004d30  67 6e 61 6d 65 3e 20 5b  52 65 73 65 72 76 65 20  |gname> [Reserve |
00004d40  3c 73 69 7a 65 3e 7c 4e  6f 52 65 73 65 72 76 65  |<size>|NoReserve|
00004d50  5d 20 5b 53 65 73 73 69  6f 6e 73 7c 4e 6f 53 65  |] [Sessions|NoSe|
00004d60  73 73 69 6f 6e 73 5d 0a  20 20 20 20 20 20 20 20  |ssions].        |
00004d70  20 20 20 20 20 20 5b 3c  6c 65 76 65 6c 3e 20 5b  |      [<level> [|
00004d80  3c 6d 61 78 2e 20 73 69  7a 65 3e 5d 5d 0a 3c 73  |<max. size>]].<s|
00004d90  69 7a 65 3e 20 61 6e 64  20 3c 6d 61 78 2e 20 73  |ize> and <max. s|
00004da0  69 7a 65 3e 20 61 72 65  20 73 70 65 63 69 66 69  |ize> are specifi|
00004db0  65 64 20 69 6e 20 6b 69  6c 6f 62 79 74 65 73 2e  |ed in kilobytes.|
00004dc0  0a 0a 41 6e 20 65 6e 74  72 79 20 66 6f 72 20 6c  |..An entry for l|
00004dd0  6f 67 20 22 2a 22 20 69  73 20 74 72 65 61 74 65  |og "*" is treate|
00004de0  64 20 61 73 20 74 68 65  20 64 65 66 61 75 6c 74  |d as the default|
00004df0  20 76 61 6c 75 65 73 2c  20 77 68 69 63 68 20 61  | values, which a|
00004e00  72 65 20 75 73 65 64 20  69 66 0a 74 68 65 20 6c  |re used if.the l|
00004e10  6f 67 20 64 6f 65 73 6e  27 74 20 68 61 76 65 20  |og doesn't have |
00004e20  61 20 73 70 65 63 69 66  69 63 20 65 6e 74 72 79  |a specific entry|
00004e30  20 69 6e 20 74 68 65 20  4f 70 74 69 6f 6e 73 20  | in the Options |
00004e40  66 69 6c 65 2e 20 53 6f  2c 20 66 6f 72 20 65 78  |file. So, for ex|
00004e50  61 6d 70 6c 65 2c 0a 74  6f 20 73 70 65 63 69 66  |ample,.to specif|
00004e60  79 20 22 4e 6f 53 65 73  73 69 6f 6e 73 22 20 66  |y "NoSessions" f|
00004e70  6f 72 20 65 76 65 72 79  20 6c 6f 67 20 65 78 63  |or every log exc|
00004e80  65 70 74 20 22 4e 65 77  73 42 69 74 65 22 20 79  |ept "NewsBite" y|
00004e90  6f 75 20 63 6f 75 6c 64  20 75 73 65 3a 0a 20 20  |ou could use:.  |
00004ea0  2a 20 4e 6f 53 65 73 73  69 6f 6e 73 0a 20 20 4e  |* NoSessions.  N|
00004eb0  65 77 73 42 69 74 65 20  53 65 73 73 69 6f 6e 73  |ewsBite Sessions|
00004ec0  0a 0a 54 68 65 20 6f 70  74 69 6f 6e 73 20 68 61  |..The options ha|
00004ed0  76 65 20 74 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |ve the following|
00004ee0  20 6d 65 61 6e 69 6e 67  73 3a 0a 0a 20 20 52 65  | meanings:..  Re|
00004ef0  73 65 72 76 65 20 3c 73  69 7a 65 3e 0a 20 20 20  |serve <size>.   |
00004f00  20 53 79 73 4c 6f 67 20  77 69 6c 6c 20 6d 61 6b  | SysLog will mak|
00004f10  65 20 73 75 72 65 20 74  68 61 74 20 61 74 20 6c  |e sure that at l|
00004f20  65 61 73 74 20 3c 73 69  7a 65 3e 20 4b 42 20 6f  |east <size> KB o|
00004f30  66 20 64 69 73 6b 20 73  70 61 63 65 20 69 73 20  |f disk space is |
00004f40  66 72 65 65 20 66 6f 72  0a 20 20 20 20 74 68 69  |free for.    thi|
00004f50  73 20 6c 6f 67 2c 20 62  79 20 70 61 64 64 69 6e  |s log, by paddin|
00004f60  67 20 74 68 65 20 6c 6f  67 20 66 69 6c 65 20 77  |g the log file w|
00004f70  69 74 68 20 7a 65 72 6f  73 20 77 68 69 63 68 20  |ith zeros which |
00004f80  61 72 65 20 6c 61 74 65  72 20 6f 76 65 72 77 72  |are later overwr|
00004f90  69 74 74 65 6e 0a 20 20  20 20 62 79 20 74 68 65  |itten.    by the|
00004fa0  20 72 65 61 6c 20 6c 6f  67 20 64 61 74 61 2e 0a  | real log data..|
00004fb0  20 20 4e 6f 52 65 73 65  72 76 65 0a 20 20 20 20  |  NoReserve.    |
00004fc0  53 79 73 4c 6f 67 20 77  6f 6e 27 74 20 72 65 73  |SysLog won't res|
00004fd0  65 72 76 65 20 64 69 73  6b 20 73 70 61 63 65 20  |erve disk space |
00004fe0  66 6f 72 20 74 68 69 73  20 6c 6f 67 20 61 73 20  |for this log as |
00004ff0  64 65 73 63 72 69 62 65  64 20 61 62 6f 76 65 2e  |described above.|
00005000  20 54 68 69 73 20 69 73  0a 20 20 20 20 74 68 65  | This is.    the|
00005010  20 64 65 66 61 75 6c 74  2e 0a 0a 20 20 53 65 73  | default...  Ses|
00005020  73 69 6f 6e 73 0a 20 20  20 20 53 79 73 4c 6f 67  |sions.    SysLog|
00005030  20 77 69 6c 6c 20 75 73  65 20 53 65 73 73 69 6f  | will use Sessio|
00005040  6e 20 4c 6f 67 73 20 66  6f 72 20 74 68 69 73 20  |n Logs for this |
00005050  6c 6f 67 20 28 61 73 20  64 65 73 63 72 69 62 65  |log (as describe|
00005060  64 20 61 62 6f 76 65 29  20 77 68 65 72 65 0a 20  |d above) where. |
00005070  20 20 20 69 6e 73 74 72  75 63 74 65 64 2e 20 54  |   instructed. T|
00005080  68 69 73 20 69 73 20 74  68 65 20 64 65 66 61 75  |his is the defau|
00005090  6c 74 2e 0a 20 20 4e 6f  53 65 73 73 69 6f 6e 73  |lt..  NoSessions|
000050a0  0a 20 20 20 20 53 65 73  73 69 6f 6e 20 4c 6f 67  |.    Session Log|
000050b0  73 20 61 72 65 20 64 69  73 61 62 6c 65 64 20 66  |s are disabled f|
000050c0  6f 72 20 74 68 69 73 20  6c 6f 67 2c 20 61 6e 64  |or this log, and|
000050d0  20 6c 6f 67 20 65 6e 74  72 69 65 73 20 77 69 6c  | log entries wil|
000050e0  6c 20 61 70 70 65 61 72  0a 20 20 20 20 73 74 72  |l appear.    str|
000050f0  69 63 74 6c 79 20 69 6e  20 63 68 72 6f 6e 6f 6c  |ictly in chronol|
00005100  6f 67 69 63 61 6c 20 6f  72 64 65 72 2e 0a 0a 20  |ogical order... |
00005110  20 3c 6c 65 76 65 6c 3e  0a 20 20 20 20 53 79 73  | <level>.    Sys|
00005120  4c 6f 67 20 77 69 6c 6c  20 69 67 6e 6f 72 65 20  |Log will ignore |
00005130  6c 6f 67 20 65 6e 74 72  69 65 73 20 66 6f 72 20  |log entries for |
00005140  74 68 69 73 20 6c 6f 67  20 77 68 69 63 68 20 68  |this log which h|
00005150  61 76 65 20 61 20 70 72  69 6f 72 69 74 79 0a 20  |ave a priority. |
00005160  20 20 20 67 72 65 61 74  65 72 20 74 6f 20 6f 72  |   greater to or|
00005170  20 65 71 75 61 6c 20 74  68 61 6e 20 74 68 69 73  | equal than this|
00005180  20 76 61 6c 75 65 2e 20  54 68 65 20 64 65 66 61  | value. The defa|
00005190  75 6c 74 20 76 61 6c 75  65 20 69 73 20 31 32 35  |ult value is 125|
000051a0  2e 0a 0a 20 20 3c 6d 61  78 2e 20 73 69 7a 65 3e  |...  <max. size>|
000051b0  0a 20 20 20 20 54 68 65  20 6c 6f 67 20 77 69 6c  |.    The log wil|
000051c0  6c 20 62 65 20 6d 6f 76  65 64 20 74 6f 20 74 68  |l be moved to th|
000051d0  65 20 22 4f 6c 64 22 20  64 69 72 65 63 74 6f 72  |e "Old" director|
000051e0  79 20 77 68 65 6e 20 69  74 20 62 65 63 6f 6d 65  |y when it become|
000051f0  73 20 6c 61 72 67 65 72  0a 20 20 20 20 74 68 61  |s larger.    tha|
00005200  6e 20 74 68 69 73 20 73  69 7a 65 2e 20 54 68 65  |n this size. The|
00005210  20 64 65 66 61 75 6c 74  20 76 61 6c 75 65 20 69  | default value i|
00005220  73 20 32 35 36 4b 42 2e  0a 0a 0a 3d 3d 3d 3d 3d  |s 256KB....=====|
00005230  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |================|
*
00005270  3d 3d 3d 3d 3d 3d 3d 0a  55 73 61 67 65 20 67 75  |=======.Usage gu|
00005280  69 64 65 6c 69 6e 65 73  0a 2d 2d 2d 2d 2d 2d 2d  |idelines.-------|
00005290  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000052d0  2d 2d 2d 2d 2d 0a 0a 50  72 65 76 69 6f 75 73 6c  |-----..Previousl|
000052e0  79 20 69 6e 20 74 68 69  73 20 73 65 63 74 69 6f  |y in this sectio|
000052f0  6e 20 49 20 72 65 63 6f  6d 6d 65 6e 64 65 64 20  |n I recommended |
00005300  74 68 61 74 20 70 72 6f  67 72 61 6d 73 20 73 68  |that programs sh|
00005310  6f 75 6c 64 20 6e 6f 74  20 66 61 69 6c 20 74 6f  |ould not fail to|
00005320  0a 77 6f 72 6b 20 69 66  20 6c 6f 67 67 69 6e 67  |.work if logging|
00005330  20 69 73 20 6e 6f 74 20  61 76 61 69 6c 61 62 6c  | is not availabl|
00005340  65 2e 20 54 68 69 73 20  69 73 20 72 65 61 73 6f  |e. This is reaso|
00005350  6e 61 62 6c 65 20 2d 20  68 6f 77 65 76 65 72 20  |nable - however |
00005360  74 68 65 72 65 20 61 72  65 0a 76 65 72 79 20 66  |there are.very f|
00005370  65 77 20 72 65 61 73 6f  6e 73 20 74 68 61 74 20  |ew reasons that |
00005380  6c 6f 67 67 69 6e 67 20  77 69 6c 6c 20 66 61 69  |logging will fai|
00005390  6c 2c 20 61 6e 64 20 61  6c 6c 20 6f 66 20 74 68  |l, and all of th|
000053a0  65 73 65 20 72 65 61 73  6f 6e 73 20 61 72 65 20  |ese reasons are |
000053b0  76 65 72 79 0a 6c 69 6b  65 6c 79 20 74 6f 20 63  |very.likely to c|
000053c0  61 75 73 65 20 74 68 65  20 6d 61 69 6e 20 66 75  |ause the main fu|
000053d0  6e 63 74 69 6f 6e 20 6f  66 20 74 68 65 20 70 72  |nction of the pr|
000053e0  6f 67 72 61 6d 20 74 6f  20 66 61 69 6c 2e 20 49  |ogram to fail. I|
000053f0  20 77 6f 75 6c 64 20 73  75 67 67 65 73 74 0a 74  | would suggest.t|
00005400  68 65 72 65 66 6f 72 65  20 74 68 61 74 20 70 72  |herefore that pr|
00005410  6f 67 72 61 6d 73 20 73  68 6f 75 6c 64 20 52 4d  |ograms should RM|
00005420  45 6e 73 75 72 65 20 74  68 65 20 53 79 73 4c 6f  |Ensure the SysLo|
00005430  67 20 6d 6f 64 75 6c 65  20 69 6e 20 74 68 65 69  |g module in thei|
00005440  72 20 21 52 75 6e 0a 66  69 6c 65 73 2c 20 61 6e  |r !Run.files, an|
00005450  64 20 74 68 65 6e 20 75  73 65 20 69 74 20 61 73  |d then use it as|
00005460  20 61 6e 79 20 6f 74 68  65 72 20 53 57 49 2e 0a  | any other SWI..|
00005470  0a 45 72 72 6f 72 73 20  66 72 6f 6d 20 53 79 73  |.Errors from Sys|
00005480  4c 6f 67 20 53 57 49 73  2c 20 77 68 69 6c 65 20  |Log SWIs, while |
00005490  73 74 72 69 63 74 6c 79  20 73 70 65 61 6b 69 6e  |strictly speakin|
000054a0  67 20 6e 6f 6e 2d 66 61  74 61 6c 20 66 6f 72 20  |g non-fatal for |
000054b0  74 68 65 20 6d 61 69 6e  0a 70 72 6f 67 72 61 6d  |the main.program|
000054c0  2c 20 61 72 65 20 69 6e  64 69 63 61 74 69 76 65  |, are indicative|
000054d0  20 6f 66 20 73 6f 6d 65  74 68 69 6e 67 20 62 65  | of something be|
000054e0  69 6e 67 20 62 61 64 6c  79 20 77 72 6f 6e 67 20  |ing badly wrong |
000054f0  77 69 74 68 20 74 68 65  20 73 79 73 74 65 6d 2e  |with the system.|
00005500  20 55 73 65 0a 27 58 27  20 53 57 49 73 20 69 6e  | Use.'X' SWIs in|
00005510  20 73 69 74 75 61 74 69  6f 6e 73 20 73 75 63 68  | situations such|
00005520  20 61 73 20 6d 6f 64 75  6c 65 73 20 77 68 65 72  | as modules wher|
00005530  65 20 79 6f 75 20 68 61  76 65 20 74 6f 2c 20 6f  |e you have to, o|
00005540  66 20 63 6f 75 72 73 65  2c 20 62 75 74 20 69 6e  |f course, but in|
00005550  0a 61 70 70 6c 69 63 61  74 69 6f 6e 20 63 6f 64  |.application cod|
00005560  65 20 77 68 65 72 65 20  79 6f 75 20 68 61 76 65  |e where you have|
00005570  20 61 6e 20 65 72 72 6f  72 20 68 61 6e 64 6c 65  | an error handle|
00005580  72 2c 20 79 6f 75 20 6d  69 67 68 74 20 61 73 20  |r, you might as |
00005590  77 65 6c 6c 20 75 73 65  20 74 68 65 0a 6e 6f 6e  |well use the.non|
000055a0  2d 27 58 27 20 66 6f 72  6d 20 61 6e 64 20 74 72  |-'X' form and tr|
000055b0  65 61 74 20 74 68 65 20  65 72 72 6f 72 73 20 61  |eat the errors a|
000055c0  73 20 79 6f 75 20 77 6f  75 6c 64 20 61 6e 79 20  |s you would any |
000055d0  6f 74 68 65 72 2e 0a 0a  50 72 6f 67 72 61 6d 73  |other...Programs|
000055e0  20 77 68 69 63 68 20 75  73 65 20 53 79 73 4c 6f  | which use SysLo|
000055f0  67 20 73 68 6f 75 6c 64  20 52 4d 45 6e 73 75 72  |g should RMEnsur|
00005600  65 20 69 74 20 69 6e 20  74 68 65 69 72 20 21 52  |e it in their !R|
00005610  75 6e 20 66 69 6c 65 73  2e 20 54 68 65 0a 73 75  |un files. The.su|
00005620  67 67 65 73 74 65 64 20  6c 69 6e 65 73 20 74 6f  |ggested lines to|
00005630  20 75 73 65 20 61 72 65  20 61 73 20 66 6f 6c 6c  | use are as foll|
00005640  6f 77 73 3a 0a 0a 49 66  20 22 3c 53 79 73 4c 6f  |ows:..If "<SysLo|
00005650  67 24 44 69 72 3e 22 3d  22 22 20 74 68 65 6e 20  |g$Dir>"="" then |
00005660  45 72 72 6f 72 20 21 53  79 73 4c 6f 67 20 61 70  |Error !SysLog ap|
00005670  70 6c 69 63 61 74 69 6f  6e 20 6e 6f 74 20 73 65  |plication not se|
00005680  65 6e 20 62 79 20 66 69  6c 65 72 0a 52 4d 45 6e  |en by filer.RMEn|
00005690  73 75 72 65 20 53 79 73  4c 6f 67 20 30 2e 31 37  |sure SysLog 0.17|
000056a0  20 52 75 6e 20 3c 53 79  73 4c 6f 67 24 44 69 72  | Run <SysLog$Dir|
000056b0  3e 2e 21 52 75 6e 0a 52  4d 45 6e 73 75 72 65 20  |>.!Run.RMEnsure |
000056c0  53 79 73 4c 6f 67 20 30  2e 31 37 20 45 72 72 6f  |SysLog 0.17 Erro|
000056d0  72 20 4d 79 41 70 70 20  6e 65 65 64 73 20 53 79  |r MyApp needs Sy|
000056e0  73 4c 6f 67 20 30 2e 31  37 20 6f 72 20 6c 61 74  |sLog 0.17 or lat|
000056f0  65 72 0a 0a 4e 6f 74 65  20 74 68 61 74 20 79 6f  |er..Note that yo|
00005700  75 20 6d 75 73 74 20 2a  6e 6f 74 2a 20 6a 75 73  |u must *not* jus|
00005710  74 20 52 4d 4c 6f 61 64  20 74 68 65 20 53 79 73  |t RMLoad the Sys|
00005720  4c 6f 67 20 6d 6f 64 75  6c 65 2c 20 61 73 20 69  |Log module, as i|
00005730  74 20 72 65 71 75 69 72  65 73 20 69 74 73 0a 57  |t requires its.W|
00005740  69 6d 70 20 74 61 73 6b  20 74 6f 20 62 65 20 61  |imp task to be a|
00005750  63 74 69 76 61 74 65 64  2c 20 61 6e 64 20 74 68  |ctivated, and th|
00005760  69 73 20 77 69 6c 6c 20  6e 6f 74 20 68 61 70 70  |is will not happ|
00005770  65 6e 20 69 66 20 79 6f  75 20 6a 75 73 74 20 52  |en if you just R|
00005780  4d 4c 6f 61 64 20 74 68  65 0a 6d 6f 64 75 6c 65  |MLoad the.module|
00005790  2e 20 54 68 65 20 6d 6f  64 75 6c 65 20 68 61 73  |. The module has|
000057a0  20 61 20 74 77 6f 2d 73  74 61 67 65 20 61 70 70  | a two-stage app|
000057b0  6c 69 63 61 74 69 6f 6e  20 65 6e 74 72 79 20 70  |lication entry p|
000057c0  6f 69 6e 74 2c 20 73 6f  20 69 74 20 77 69 6c 6c  |oint, so it will|
000057d0  0a 72 65 74 75 72 6e 20  69 6d 6d 65 64 69 61 74  |.return immediat|
000057e0  65 6c 79 20 77 68 65 6e  20 79 6f 75 20 52 4d 52  |ely when you RMR|
000057f0  75 6e 20 69 74 2c 20 61  6c 6c 6f 77 69 6e 67 20  |un it, allowing |
00005800  74 68 65 20 21 52 75 6e  20 66 69 6c 65 20 74 6f  |the !Run file to|
00005810  20 63 6f 6e 74 69 6e 75  65 20 61 73 0a 6e 6f 72  | continue as.nor|
00005820  6d 61 6c 2e 0a                                    |mal..|
00005825