Difference between revisions of "Unit Logging"

From Ultibo.org
Jump to: navigation, search
Line 84: Line 84:
 
----
 
----
  
''To be documented''
+
 
 +
'''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: Overlayed on TMessage to avoid memory allocation on each output
 +
|-
 +
| <code>Data:String;</code>
 +
| TMessage.Msg:LongWord
 +
|-
 +
| <code>Reserved1:LongInt;</code>
 +
| TMessage.wParam:LongInt
 +
|-
 +
| <code>Reserved2:LongInt;</code>
 +
| TMessage.lParam:LongInt
 +
|-
 +
| <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: Overlayed on TMessage to avoid memory allocation on each output
 +
|-
 +
| <code>Content:String;</code>
 +
| TMessage.Msg:LongWord
 +
|-
 +
| <code>Tag:String;</code>
 +
| TMessage.wParam:LongInt
 +
|-
 +
| <code>Severity:LongInt;</code>
 +
| TMessage.lParam:LongInt
 +
|-
 +
| <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>
 +
| &nbsp;
 +
|-
 +
|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>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|colspan="2"|''Console Properties''
 +
|-
 +
| <code>Console:PConsoleDevice;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Window:TWindowHandle;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===

Revision as of 05:01, 20 January 2017

Return to Unit Reference


Description


Ultibo Logging interface unit

To be documented

Constants



[Expand]
Logging specific constants LOGGING_*


[Expand]
Logging device type constants LOGGING_TYPE_*


[Expand]
Logging device state constants LOGGING_STATE_*


[Expand]
Logging device flag constants LOGGING_FLAG_*


Type definitions



Logging entry

[Expand]

PLoggingEntry = ^TLoggingEntry;

TLoggingEntry = record

Logging entry ex

[Expand]

PLoggingEntryEx = ^TLoggingEntryEx;

TLoggingEntryEx = record

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

[Expand]

PLoggingDevice = ^TLoggingDevice;

TLoggingDevice = record

Console logging

[Expand]

PConsoleLogging = ^TConsoleLogging;

TConsoleLogging = record


Public variables


None defined

Function declarations



Initialization functions

[Expand]
procedure LoggingInit;
Description: To be documented


[Expand]
function LoggingExecute(Parameter:Pointer):PtrInt;
Description: To be documented


Logging functions

[Expand]
function LoggingDeviceStart(Logging:PLoggingDevice):LongWord;
Description: To be documented


[Expand]
function LoggingDeviceStop(Logging:PLoggingDevice):LongWord;
Description: To be documented


[Expand]
function LoggingDeviceOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Description: To be documented


[Expand]
function LoggingDeviceOutputEx(Logging:PLoggingDevice; Facility,Severity:LongWord; const Tag,Content:String):LongWord;
Description: To be documented


[Expand]
function LoggingDeviceGetTarget(Logging:PLoggingDevice):String;
Description: To be documented


[Expand]
function LoggingDeviceSetTarget(Logging:PLoggingDevice; const Target:String):LongWord;
Description: To be documented


[Expand]
function LoggingDeviceCreate(Default:Boolean):PLoggingDevice;
Description: Create a new Logging device entry


[Expand]
function LoggingDeviceCreateEx(Size:LongWord; Default:Boolean):PLoggingDevice;
Description: Create a new Logging device entry


[Expand]
function LoggingDeviceDestroy(Logging:PLoggingDevice):LongWord;
Description: Destroy an existing Logging device entry


[Expand]
function LoggingDeviceRegister(Logging:PLoggingDevice):LongWord;
Description: Register a new Logging device in the Logging table


[Expand]
function LoggingDeviceDeregister(Logging:PLoggingDevice):LongWord;
Description: Deregister a Logging device from the Logging table


[Expand]
function LoggingDeviceFind(LoggingId:LongWord):PLoggingDevice;
Description: To be documented


[Expand]
function LoggingDeviceFindByType(LoggingType:LongWord):PLoggingDevice;
Description: To be documented


[Expand]
function LoggingDeviceFindByDevice(Device:PDevice):PLoggingDevice;
Description: To be documented


[Expand]
function LoggingDeviceFindByName(const Name:String):PLoggingDevice; inline;
Description: To be documented


[Expand]
function LoggingDeviceFindByDescription(const Description:String):PLoggingDevice; inline;
Description: To be documented


[Expand]
function LoggingDeviceEnumerate(Callback:TLoggingEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function LoggingDeviceNotification(Logging:PLoggingDevice; Callback:TLoggingNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented


Console logging functions

[Expand]
function ConsoleLoggingStart(Logging:PLoggingDevice):LongWord;
Description: To be documented


[Expand]
function ConsoleLoggingStop(Logging:PLoggingDevice):LongWord;
Description: To be documented


[Expand]
function ConsoleLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Description: To be documented


RTL logging functions

[Expand]
procedure SysLoggingOutput(const AText:String);
Description: To be documented


[Expand]
procedure SysLoggingOutputEx(AFacility,ASeverity:LongWord; const ATag,AContent:String);
Description: To be documented


Logging helper functions

[Expand]
function LoggingDeviceGetCount:LongWord; inline;
Description: Get the current logging device count


[Expand]
function LoggingDeviceGetDefault:PLoggingDevice; inline;
Description: Get the current default logging device


[Expand]
function LoggingDeviceSetDefault(Logging:PLoggingDevice):LongWord;
Description: Set the current default logging device


[Expand]
function LoggingDeviceCheck(Logging:PLoggingDevice):PLoggingDevice;
Description: Check if the supplied Logging device is in the Logging table


[Expand]
function LoggingGetMessageslotFlags:LongWord;
Description: Get the lock flags for the logging messageslot


[Expand]
function LoggingConsoleDeviceAdd(Console:PConsoleDevice):LongWord;
Description: To be documented


[Expand]
function LoggingConsoleDeviceRemove(Console:PConsoleDevice):LongWord;
Description: To be documented


[Expand]
function LoggingConsoleDeviceEnum(Console:PConsoleDevice; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function LoggingConsoleDeviceNotify(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
Description: To be documented


Return to Unit Reference