Aros/Developer/Docs/Logging

This is currently a draft page ...

=Logging Subsystem Components=


 * log.resource             : Generic API to logging.


 * debug.logger         : hardcoded processor for debug log output. used for
 * other log types until exec can handle memory requests.


 * generic.logger       : hardcoded processor used after log.resource:init to process all but debug logging.
 * NB -: should not be used inside allocmem/freemem (since it may use them) or IRQs


 * seriallog.resource       : rom resident listener which dumps DEBUG type log output to the serial device
 * (configurable via grub command line)

Support Commands

 * C:BufferLog LOGTYPE OUTPUTFILE
 * Registers a listener for the specified LOGTYPE which Buffers log output to an OUTPUTFILE.


 * SYS:Tools/LogViewer LOGFILE
 * Tool used to display LOGFILE's buffered with C:BufferLog.

=Logging Subsystem Operations=

=Logging API's=


 * LOG_TYPEID:   LOG_DATA
 * LOG_TYPE_DEBUG
 * DEBUG_ERROR
 * DEBUG_WARN
 * DEBUG_INFO


 * LOG_TYPE_SYSTEM
 * SYSTEM_ERROR
 * SYSTEM_WARN
 * SYSTEM_INFO


 * LOG_TYPE_APPLICATION
 * APPLICATION_ERROR
 * APPLICATION_WARN
 * APPLICATION_INFO

IPTR LOGR_RegisterProcessor(LOG_TYPEID, struct LogProcessor *)

IPTR LOGR_RegisterListener(LOG_TYPEID, struct LogListener *)

BOOL LOGR_LogEvent(LOG_TYPEID, LOG_DATA, char *LOG_SRC, char *LOG_TEMPLATE, args ...)

IPTR LOGR_ObtainLogEvents(LOG_TYPEID, LOG_EVENTFLAGS)

IPTR LOGR_LogEventNext(IPTR)

IPTR LOGR_LogEventDelete(IPTR)

IPTR LOGR_ReleaseLogEvents(IPTR)

LOGR_LogEvent
Used to output data to a specified log.

LOGR_ObtainLogEvents
Returns a per caller handle. if (LOG_EVENTFLAGS == LOG_EVENTLIST_UNIQUE) then it will only succeed if no other access is occurring.

internal: sets handle->active_event to the first log entry and increases its access count.

LOGR_LogEventNext
(semaphore protected?)

internal: sets handle->active_event to the next log entry - decreasing the current one's access count and increasing the next's access count

LOGR_LogEventDelete
(semaphore protected?)

Deletes a log entry.

internal: deletes handle->active_event - or marks it for deletion if its access count > 0

LOGR_ReleaseLogEvents
Must be called with a handle obtained with LOGR_ObtainLogEvents. decreases the handle->active_event's access count, and frees the per caller handle.