Difference between revisions of "Unit Logging"
(15 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '' | + | '''Ultibo Logging Interface unit''' |
=== Constants === | === Constants === | ||
---- | ---- | ||
− | '' | + | |
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Logging specific constants''' <code> LOGGING_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>LOGGING_NAME_PREFIX = 'Logging';</code> | ||
+ | | Name prefix for Logging Devices | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>LOGGING_THREAD_NAME = 'Logging';</code> | ||
+ | | Thread name for Logging threads | ||
+ | |- | ||
+ | | <code>LOGGING_THREAD_PRIORITY = THREAD_PRIORITY_NORMAL;</code> | ||
+ | | Thread priority for Logging threads | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Logging device type''' <code> LOGGING_TYPE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>LOGGING_TYPE_NONE = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>LOGGING_TYPE_CONSOLE = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>LOGGING_TYPE_FILE = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>LOGGING_TYPE_SYSLOG = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>LOGGING_TYPE_SERIAL = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>LOGGING_TYPE_MAX = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Logging device state''' <code> LOGGING_STATE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>LOGGING_STATE_DISABLED = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>LOGGING_STATE_ENABLED = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>LOGGING_STATE_MAX = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Logging device flag''' <code> LOGGING_FLAG_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>LOGGING_FLAG_NONE = $00000000;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Console logging''' <code> CONSOLE_LOGGING_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>CONSOLE_LOGGING_DESCRIPTION = 'Console Logging';</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Type definitions === | === Type definitions === | ||
---- | ---- | ||
− | '' | + | |
+ | '''Logging entry''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PLoggingEntry = ^TLoggingEntry;</code> | ||
+ | |||
+ | <code>TLoggingEntry = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Overlaid on TMessage to avoid memory allocation on each output | ||
+ | |- | ||
+ | | <code>Data:String;</code> | ||
+ | | TMessage.Msg:PtrUInt | ||
+ | |- | ||
+ | | <code>Reserved1:PtrUInt;</code> | ||
+ | | TMessage.wParam:PtrUInt | ||
+ | |- | ||
+ | | <code>Reserved2:PtrInt;</code> | ||
+ | | TMessage.lParam:PtrInt | ||
+ | |- | ||
+ | | <code>Reserved3:LongWord;</code> | ||
+ | | TMessage.Time:LongWord | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Logging entry ex''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PLoggingEntryEx = ^TLoggingEntryEx;</code> | ||
+ | |||
+ | <code>TLoggingEntryEx = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Overlaid on TMessage to avoid memory allocation on each output | ||
+ | |- | ||
+ | | <code>Content:String;</code> | ||
+ | | TMessage.Msg:PtrUInt | ||
+ | |- | ||
+ | | <code>Tag:String;</code> | ||
+ | | TMessage.wParam:PtrUInt | ||
+ | |- | ||
+ | | <code>Severity:PtrInt;</code> | ||
+ | | TMessage.lParam:PtrInt | ||
+ | |- | ||
+ | | <code>Facility:LongWord;</code> | ||
+ | | TMessage.Time:LongWord | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Logging enumeration callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingEnumerate = function(Logging:PLoggingDevice; Data:Pointer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging notification callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging device start''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingDeviceStart = function(Logging:PLoggingDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging device stop''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingDeviceStop = function(Logging:PLoggingDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging device output''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingDeviceOutput = function(Logging:PLoggingDevice; const Data:String):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging device output ex''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingDeviceOutputEx = function(Logging:PLoggingDevice; Facility,Severity:LongWord; const Tag,Content:String):LongWord;</code> | ||
+ | | style="width: 40%;"|Syslog compatible output | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging device get target''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingDeviceGetTarget = function(Logging:PLoggingDevice):String;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging device set target''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TLoggingDeviceSetTarget = function(Logging:PLoggingDevice; const Target:String):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Logging device''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PLoggingDevice = ^TLoggingDevice;</code> | ||
+ | |||
+ | <code>TLoggingDevice = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Device Properties'' | ||
+ | |- | ||
+ | | <code>Device:TDevice;</code> | ||
+ | | The Device entry for this Logging device | ||
+ | |- | ||
+ | |colspan="2"|''Logging Properties'' | ||
+ | |- | ||
+ | | <code>LoggingId:LongWord;</code> | ||
+ | | Unique Id of this Logging device in the Logging device table | ||
+ | |- | ||
+ | | <code>LoggingState:LongWord;</code> | ||
+ | | Logging device state (eg LOGGING_STATE_ENABLED) | ||
+ | |- | ||
+ | | <code>DeviceStart:TLoggingDeviceStart;</code> | ||
+ | | A device specific DeviceStart method implementing a standard logging device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceStop:TLoggingDeviceStop;</code> | ||
+ | | A device specific DeviceStop method implementing a standard logging device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceOutput:TLoggingDeviceOutput;</code> | ||
+ | | A device specific DeviceOutput method implementing a standard logging device interface | ||
+ | |- | ||
+ | | <code>DeviceOutputEx:TLoggingDeviceOutputEx;</code> | ||
+ | | A device specific DeviceOutputEx method implementing a standard logging device interface | ||
+ | |- | ||
+ | | <code>DeviceGetTarget:TLoggingDeviceGetTarget;</code> | ||
+ | | A device specific DeviceGetTarget method implementing a standard logging device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetTarget:TLoggingDeviceSetTarget;</code> | ||
+ | | A device specific DeviceSetTarget method implementing a standard logging device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>OutputCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Device lock | ||
+ | |- | ||
+ | | <code>Handle:THandle;</code> | ||
+ | | Device output handle | ||
+ | |- | ||
+ | | <code>Target:String;</code> | ||
+ | | Device output target | ||
+ | |- | ||
+ | | <code>Default:LongBool;</code> | ||
+ | | Device can be the default logging device | ||
+ | |- | ||
+ | |colspan="2"|''Internal Properties'' | ||
+ | |- | ||
+ | | <code>Prev:PLoggingDevice;</code> | ||
+ | | Previous entry in Logging device table | ||
+ | |- | ||
+ | | <code>Next:PLoggingDevice;</code> | ||
+ | | Next entry in Logging device table | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Console logging''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PConsoleLogging = ^TConsoleLogging;</code> | ||
+ | |||
+ | <code>TConsoleLogging = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Logging Properties'' | ||
+ | |- | ||
+ | | <code>Logging:TLoggingDevice;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Console Properties'' | ||
+ | |- | ||
+ | | <code>Console:PConsoleDevice;</code> | ||
+ | | The console device for logging output | ||
+ | |- | ||
+ | | <code>Window:TWindowHandle;</code> | ||
+ | | The console window for logging output | ||
+ | |- | ||
+ | | <code>Existing:LongBool;</code> | ||
+ | | True if the console window already existed when logging started | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
---- | ---- | ||
− | '' | + | ''None defined'' |
=== Function declarations === | === Function declarations === | ||
Line 34: | Line 344: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 46: | Line 356: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 61: | Line 371: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 73: | Line 383: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 85: | Line 395: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 97: | Line 407: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 109: | Line 419: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 121: | Line 431: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 133: | Line 443: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Default |
+ | | If true allow the new device the default logging device if there is no current default | ||
+ | |- | ||
+ | ! Return | ||
| Pointer to new Logging device entry or nil if Logging device could not be created | | Pointer to new Logging device entry or nil if Logging device could not be created | ||
|- | |- | ||
Line 145: | Line 458: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Size |
| Size in bytes to allocate for new Logging (Including the Logging entry) | | Size in bytes to allocate for new Logging (Including the Logging entry) | ||
|- | |- | ||
− | ! | + | ! Default |
+ | | If true allow the new device the default logging device if there is no current default | ||
+ | |- | ||
+ | ! Return | ||
| Pointer to new Logging device entry or nil if Logging device could not be created | | Pointer to new Logging device entry or nil if Logging device could not be created | ||
|- | |- | ||
Line 160: | Line 476: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 172: | Line 488: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 184: | Line 500: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 196: | Line 512: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 208: | Line 524: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 220: | Line 536: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 232: | Line 548: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 244: | Line 560: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 256: | Line 572: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 268: | Line 584: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 279: | Line 595: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function ConsoleLoggingStart(Logging:PLoggingDevice):LongWord;</pre> | <pre style="border: 0; padding-bottom:0px;">function ConsoleLoggingStart(Logging:PLoggingDevice):LongWord;</pre> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of LoggingDeviceStart API for Console Logging</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | Not intended to be called directly by applications, use LoggingDeviceStart instead. |
|- | |- | ||
|} | |} | ||
Line 291: | Line 607: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function ConsoleLoggingStop(Logging:PLoggingDevice):LongWord;</pre> | <pre style="border: 0; padding-bottom:0px;">function ConsoleLoggingStop(Logging:PLoggingDevice):LongWord;</pre> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of LoggingDeviceStop API for Console Logging</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | Not intended to be called directly by applications, use LoggingDeviceStop instead. |
|- | |- | ||
|} | |} | ||
Line 303: | Line 619: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function ConsoleLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;</pre> | <pre style="border: 0; padding-bottom:0px;">function ConsoleLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;</pre> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of LoggingDeviceOutput API for Console Logging</div> |
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use LoggingDeviceOutput instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function ConsoleLoggingSetTarget(Logging:PLoggingDevice; const Target:String):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of LoggingDeviceSetTarget API for Console Logging</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use LoggingDeviceSetTarget instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''RTL text IO functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function SysTextIOWriteChar(ACh:Char; AUserData:Pointer):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Handler for platform TextIOWriteChar function</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function SysTextIOWriteBuffer(ABuffer:PChar; ACount:LongInt; AUserData:Pointer):LongInt;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Handler for platform TextIOWriteBuffer function</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | Not intended to be called directly by applications |
|- | |- | ||
|} | |} | ||
Line 322: | Line 677: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 334: | Line 689: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 344: | Line 699: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function LoggingDeviceGetCount:LongWord | + | <pre style="border: 0; padding-bottom:0px;">function LoggingDeviceGetCount:LongWord;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current logging device count</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current logging device count</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 356: | Line 711: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function LoggingDeviceGetDefault:PLoggingDevice | + | <pre style="border: 0; padding-bottom:0px;">function LoggingDeviceGetDefault:PLoggingDevice;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default logging device</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default logging device</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 373: | Line 728: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 385: | Line 740: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! '''Note''' | + | ! Note |
− | | | + | | None documented |
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LoggingTypeToString(LoggingType:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Logging type value to a string</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LoggingStateToString(LoggingState:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Logging state value to a string</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function LoggingDeviceRedirectOutput(Logging:PLoggingDevice):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Redirect standard output to the logging device specified by Logging</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Logging | ||
+ | | The logging device to redirect output to (or nil to stop redirection) | ||
+ | |- | ||
+ | ! Return | ||
+ | | True if completed successfully or False if an error occurred | ||
+ | |- | ||
+ | ! Note | ||
+ | | Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library. | ||
|- | |- | ||
|} | |} | ||
Line 397: | Line 794: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 409: | Line 806: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 421: | Line 818: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 433: | Line 830: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} | ||
Line 445: | Line 842: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | | + | | None documented |
|- | |- | ||
|} | |} |
Latest revision as of 05:27, 1 March 2023
Return to Unit Reference
Description
Ultibo Logging Interface unit
Constants
LOGGING_*
LOGGING_NAME_PREFIX = 'Logging';
|
Name prefix for Logging Devices |
LOGGING_THREAD_NAME = 'Logging';
|
Thread name for Logging threads |
LOGGING_THREAD_PRIORITY = THREAD_PRIORITY_NORMAL;
|
Thread priority for Logging threads |
LOGGING_TYPE_*
LOGGING_TYPE_NONE = 0;
|
|
LOGGING_TYPE_CONSOLE = 1;
|
|
LOGGING_TYPE_FILE = 2;
|
|
LOGGING_TYPE_SYSLOG = 3;
|
|
LOGGING_TYPE_SERIAL = 4;
|
|
LOGGING_TYPE_MAX = 4;
|
LOGGING_STATE_*
LOGGING_STATE_DISABLED = 0;
|
|
LOGGING_STATE_ENABLED = 1;
|
|
LOGGING_STATE_MAX = 1;
|
LOGGING_FLAG_*
LOGGING_FLAG_NONE = $00000000;
|
CONSOLE_LOGGING_*
CONSOLE_LOGGING_DESCRIPTION = 'Console Logging';
|
Type definitions
Logging entry
PLoggingEntry = ^TLoggingEntry;
TLoggingEntry = record
Note: Overlaid on TMessage to avoid memory allocation on each output | |
Data:String;
|
TMessage.Msg:PtrUInt |
Reserved1:PtrUInt;
|
TMessage.wParam:PtrUInt |
Reserved2:PtrInt;
|
TMessage.lParam:PtrInt |
Reserved3:LongWord;
|
TMessage.Time:LongWord |
Logging entry ex
PLoggingEntryEx = ^TLoggingEntryEx;
TLoggingEntryEx = record
Note: Overlaid on TMessage to avoid memory allocation on each output | |
Content:String;
|
TMessage.Msg:PtrUInt |
Tag:String;
|
TMessage.wParam:PtrUInt |
Severity:PtrInt;
|
TMessage.lParam:PtrInt |
Facility:LongWord;
|
TMessage.Time:LongWord |
Logging enumeration callback
TLoggingEnumerate = function(Logging:PLoggingDevice; Data:Pointer):LongWord;
|
Logging notification callback
TLoggingNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
|
Logging device start
TLoggingDeviceStart = function(Logging:PLoggingDevice):LongWord;
|
Logging device stop
TLoggingDeviceStop = function(Logging:PLoggingDevice):LongWord;
|
Logging device output
TLoggingDeviceOutput = function(Logging:PLoggingDevice; const Data:String):LongWord;
|
Logging device output ex
TLoggingDeviceOutputEx = function(Logging:PLoggingDevice; Facility,Severity:LongWord; const Tag,Content:String):LongWord;
|
Syslog compatible output |
Logging device get target
TLoggingDeviceGetTarget = function(Logging:PLoggingDevice):String;
|
Logging device set target
TLoggingDeviceSetTarget = function(Logging:PLoggingDevice; const Target:String):LongWord;
|
Logging device
PLoggingDevice = ^TLoggingDevice;
TLoggingDevice = record
Device Properties | |
Device:TDevice;
|
The Device entry for this Logging device |
Logging Properties | |
LoggingId:LongWord;
|
Unique Id of this Logging device in the Logging device table |
LoggingState:LongWord;
|
Logging device state (eg LOGGING_STATE_ENABLED) |
DeviceStart:TLoggingDeviceStart;
|
A device specific DeviceStart method implementing a standard logging device interface (Or nil if the default method is suitable) |
DeviceStop:TLoggingDeviceStop;
|
A device specific DeviceStop method implementing a standard logging device interface (Or nil if the default method is suitable) |
DeviceOutput:TLoggingDeviceOutput;
|
A device specific DeviceOutput method implementing a standard logging device interface |
DeviceOutputEx:TLoggingDeviceOutputEx;
|
A device specific DeviceOutputEx method implementing a standard logging device interface |
DeviceGetTarget:TLoggingDeviceGetTarget;
|
A device specific DeviceGetTarget method implementing a standard logging device interface (Or nil if the default method is suitable) |
DeviceSetTarget:TLoggingDeviceSetTarget;
|
A device specific DeviceSetTarget method implementing a standard logging device interface (Or nil if the default method is suitable) |
Statistics Properties | |
OutputCount:LongWord;
|
|
Driver Properties | |
Lock:TMutexHandle;
|
Device lock |
Handle:THandle;
|
Device output handle |
Target:String;
|
Device output target |
Default:LongBool;
|
Device can be the default logging device |
Internal Properties | |
Prev:PLoggingDevice;
|
Previous entry in Logging device table |
Next:PLoggingDevice;
|
Next entry in Logging device table |
Console logging
PConsoleLogging = ^TConsoleLogging;
TConsoleLogging = record
Logging Properties | |
Logging:TLoggingDevice;
|
|
Console Properties | |
Console:PConsoleDevice;
|
The console device for logging output |
Window:TWindowHandle;
|
The console window for logging output |
Existing:LongBool;
|
True if the console window already existed when logging started |
Public variables
None defined
Function declarations
Initialization functions
procedure LoggingInit;
Note | None documented |
---|
function LoggingExecute(Parameter:Pointer):PtrInt;
Note | None documented |
---|
Logging functions
function LoggingDeviceStart(Logging:PLoggingDevice):LongWord;
Note | None documented |
---|
function LoggingDeviceStop(Logging:PLoggingDevice):LongWord;
Note | None documented |
---|
function LoggingDeviceOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Note | None documented |
---|
function LoggingDeviceOutputEx(Logging:PLoggingDevice; Facility,Severity:LongWord; const Tag,Content:String):LongWord;
Note | None documented |
---|
function LoggingDeviceGetTarget(Logging:PLoggingDevice):String;
Note | None documented |
---|
function LoggingDeviceSetTarget(Logging:PLoggingDevice; const Target:String):LongWord;
Note | None documented |
---|
function LoggingDeviceCreate(Default:Boolean):PLoggingDevice;
Default | If true allow the new device the default logging device if there is no current default |
---|---|
Return | Pointer to new Logging device entry or nil if Logging device could not be created |
function LoggingDeviceCreateEx(Size:LongWord; Default:Boolean):PLoggingDevice;
Size | Size in bytes to allocate for new Logging (Including the Logging entry) |
---|---|
Default | If true allow the new device the default logging device if there is no current default |
Return | Pointer to new Logging device entry or nil if Logging device could not be created |
function LoggingDeviceDestroy(Logging:PLoggingDevice):LongWord;
Note | None documented |
---|
function LoggingDeviceRegister(Logging:PLoggingDevice):LongWord;
Note | None documented |
---|
function LoggingDeviceDeregister(Logging:PLoggingDevice):LongWord;
Note | None documented |
---|
function LoggingDeviceFind(LoggingId:LongWord):PLoggingDevice;
Note | None documented |
---|
function LoggingDeviceFindByType(LoggingType:LongWord):PLoggingDevice;
Note | None documented |
---|
function LoggingDeviceFindByDevice(Device:PDevice):PLoggingDevice;
Note | None documented |
---|
function LoggingDeviceFindByName(const Name:String):PLoggingDevice; inline;
Note | None documented |
---|
function LoggingDeviceFindByDescription(const Description:String):PLoggingDevice; inline;
Note | None documented |
---|
function LoggingDeviceEnumerate(Callback:TLoggingEnumerate; Data:Pointer):LongWord;
Note | None documented |
---|
function LoggingDeviceNotification(Logging:PLoggingDevice; Callback:TLoggingNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Note | None documented |
---|
Console logging functions
function ConsoleLoggingStart(Logging:PLoggingDevice):LongWord;
Note | Not intended to be called directly by applications, use LoggingDeviceStart instead. |
---|
function ConsoleLoggingStop(Logging:PLoggingDevice):LongWord;
Note | Not intended to be called directly by applications, use LoggingDeviceStop instead. |
---|
function ConsoleLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Note | Not intended to be called directly by applications, use LoggingDeviceOutput instead. |
---|
function ConsoleLoggingSetTarget(Logging:PLoggingDevice; const Target:String):LongWord;
Note | Not intended to be called directly by applications, use LoggingDeviceSetTarget instead. |
---|
RTL text IO functions
function SysTextIOWriteChar(ACh:Char; AUserData:Pointer):Boolean;
Note | Not intended to be called directly by applications |
---|
function SysTextIOWriteBuffer(ABuffer:PChar; ACount:LongInt; AUserData:Pointer):LongInt;
Note | Not intended to be called directly by applications |
---|
RTL logging functions
procedure SysLoggingOutput(const AText:String);
Note | None documented |
---|
procedure SysLoggingOutputEx(AFacility,ASeverity:LongWord; const ATag,AContent:String);
Note | None documented |
---|
Logging helper functions
function LoggingDeviceGetCount:LongWord;
Note | None documented |
---|
function LoggingDeviceGetDefault:PLoggingDevice;
Note | None documented |
---|
function LoggingDeviceSetDefault(Logging:PLoggingDevice):LongWord;
Note | None documented |
---|
function LoggingDeviceCheck(Logging:PLoggingDevice):PLoggingDevice;
Note | None documented |
---|
function LoggingTypeToString(LoggingType:LongWord):String;
Note | None documented |
---|
function LoggingStateToString(LoggingState:LongWord):String;
Note | None documented |
---|
function LoggingDeviceRedirectOutput(Logging:PLoggingDevice):Boolean;
Logging | The logging device to redirect output to (or nil to stop redirection) |
---|---|
Return | True if completed successfully or False if an error occurred |
Note | Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library. |
function LoggingGetMessageslotFlags:LongWord;
Note | None documented |
---|
function LoggingConsoleDeviceAdd(Console:PConsoleDevice):LongWord;
Note | None documented |
---|
function LoggingConsoleDeviceRemove(Console:PConsoleDevice):LongWord;
Note | None documented |
---|
function LoggingConsoleDeviceEnum(Console:PConsoleDevice; Data:Pointer):LongWord;
Note | None documented |
---|
function LoggingConsoleDeviceNotify(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
Note | None documented |
---|
Return to Unit Reference