Difference between revisions of "Unit Logging"

From Ultibo.org
Jump to: navigation, search
Line 75: Line 75:
 
|-
 
|-
 
| <code>LOGGING_FLAG_NONE = $00000000;</code>
 
| <code>LOGGING_FLAG_NONE = $00000000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</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%;"|&nbsp;
 
| style="width: 50%;"|&nbsp;
 
|-
 
|-

Revision as of 05:39, 7 June 2017

Return to Unit Reference


Description


Ultibo Logging interface unit

To be documented

Constants



Logging specific 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 device type LOGGING_TYPE_*
LOGGING_TYPE_NONE = 0;  
LOGGING_TYPE_CONSOLE = 1;  
LOGGING_TYPE_FILE = 2;  
LOGGING_TYPE_SYSLOG = 3;  
LOGGING_TYPE_SERIAL = 4;  


Logging device state LOGGING_STATE_*
LOGGING_STATE_DISABLED = 0;  
LOGGING_STATE_ENABLED = 1;  


Logging device flag LOGGING_FLAG_*
LOGGING_FLAG_NONE = $00000000;  


Console logging CONSOLE_LOGGING_*
CONSOLE_LOGGING_DESCRIPTION = 'Console Logging';  


Type definitions



Logging entry

PLoggingEntry = ^TLoggingEntry;

TLoggingEntry = record

Note: Overlayed on TMessage to avoid memory allocation on each output
Data:String; TMessage.Msg:LongWord
Reserved1:LongInt; TMessage.wParam:LongInt
Reserved2:LongInt; TMessage.lParam:LongInt
Reserved3:LongWord; TMessage.Time:LongWord

Logging entry ex

PLoggingEntryEx = ^TLoggingEntryEx;

TLoggingEntryEx = record

Note: Overlayed on TMessage to avoid memory allocation on each output
Content:String; TMessage.Msg:LongWord
Tag:String; TMessage.wParam:LongInt
Severity:LongInt; TMessage.lParam:LongInt
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;  
Window:TWindowHandle;  


Public variables


None defined

Function declarations



Initialization functions

procedure LoggingInit;
Description: To be documented
Note None documented


function LoggingExecute(Parameter:Pointer):PtrInt;
Description: To be documented
Note None documented


Logging functions

function LoggingDeviceStart(Logging:PLoggingDevice):LongWord;
Description: To be documented
Note None documented


function LoggingDeviceStop(Logging:PLoggingDevice):LongWord;
Description: To be documented
Note None documented


function LoggingDeviceOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Description: To be documented
Note None documented


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


function LoggingDeviceGetTarget(Logging:PLoggingDevice):String;
Description: To be documented
Note None documented


function LoggingDeviceSetTarget(Logging:PLoggingDevice; const Target:String):LongWord;
Description: To be documented
Note None documented


function LoggingDeviceCreate(Default:Boolean):PLoggingDevice;
Description: Create a new Logging device entry
Return Pointer to new Logging device entry or nil if Logging device could not be created


function LoggingDeviceCreateEx(Size:LongWord; Default:Boolean):PLoggingDevice;
Description: Create a new Logging device entry
Size Size in bytes to allocate for new Logging (Including the Logging entry)
Return Pointer to new Logging device entry or nil if Logging device could not be created


function LoggingDeviceDestroy(Logging:PLoggingDevice):LongWord;
Description: Destroy an existing Logging device entry
Note None documented


function LoggingDeviceRegister(Logging:PLoggingDevice):LongWord;
Description: Register a new Logging device in the Logging table
Note None documented


function LoggingDeviceDeregister(Logging:PLoggingDevice):LongWord;
Description: Deregister a Logging device from the Logging table
Note None documented


function LoggingDeviceFind(LoggingId:LongWord):PLoggingDevice;
Description: To be documented
Note None documented


function LoggingDeviceFindByType(LoggingType:LongWord):PLoggingDevice;
Description: To be documented
Note None documented


function LoggingDeviceFindByDevice(Device:PDevice):PLoggingDevice;
Description: To be documented
Note None documented


function LoggingDeviceFindByName(const Name:String):PLoggingDevice; inline;
Description: To be documented
Note None documented


function LoggingDeviceFindByDescription(const Description:String):PLoggingDevice; inline;
Description: To be documented
Note None documented


function LoggingDeviceEnumerate(Callback:TLoggingEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


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


Console logging functions

function ConsoleLoggingStart(Logging:PLoggingDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleLoggingStop(Logging:PLoggingDevice):LongWord;
Description: To be documented
Note None documented


function ConsoleLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Description: To be documented
Note None documented


RTL logging functions

procedure SysLoggingOutput(const AText:String);
Description: To be documented
Note None documented


procedure SysLoggingOutputEx(AFacility,ASeverity:LongWord; const ATag,AContent:String);
Description: To be documented
Note None documented


Logging helper functions

function LoggingDeviceGetCount:LongWord; inline;
Description: Get the current logging device count
Note None documented


function LoggingDeviceGetDefault:PLoggingDevice; inline;
Description: Get the current default logging device
Note None documented


function LoggingDeviceSetDefault(Logging:PLoggingDevice):LongWord;
Description: Set the current default logging device
Note None documented


function LoggingDeviceCheck(Logging:PLoggingDevice):PLoggingDevice;
Description: Check if the supplied Logging device is in the Logging table
Note None documented


function LoggingGetMessageslotFlags:LongWord;
Description: Get the lock flags for the logging messageslot
Note None documented


function LoggingConsoleDeviceAdd(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


function LoggingConsoleDeviceRemove(Console:PConsoleDevice):LongWord;
Description: To be documented
Note None documented


function LoggingConsoleDeviceEnum(Console:PConsoleDevice; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function LoggingConsoleDeviceNotify(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
Description: To be documented
Note None documented


Return to Unit Reference