Skip to content

TIox2Log

Provides logging functionality for iceoryx2. Allows configuration of log levels, custom loggers, and built-in console/file logging.

Definition

Unit: Neslib.Iceoryx2.Logging

type TIox2Log = record ... end;

Remarks

Starting with iceoryx2 v0.8.0, the console logger is enabled by default.

Properties

Name Description
LogLevel The current log level. This is ignored for external logging frameworks.

Methods

Name Description
SetLogger Sets a custom logger callback. This function can only be called once and must be called before any log message is created.
SetLoggerUtf8 Sets a custom logger callback. This function can only be called once and must be called before any log message is created.
SetLogLevelFromEnvOr Sets the log level from the IOX2_LOG_LEVEL environment variable, or uses the specified level if the variable is not set.
SetLogLevelFromEnvOrDefault Sets the log level from the IOX2_LOG_LEVEL environment variable, or defaults to Info if the variable is not set.
Write Writes a log message to the logger.
WriteUtf8 Writes a log message to the logger.

Property Descriptions

LogLevel

The current log level. This is ignored for external logging frameworks.

class property LogLevel: TLogLevel read GetLogLevel write SetLogLevel

Type: TLogLevel


Method Descriptions

SetLogger(TLogCallback)

Sets a custom logger callback. This function can only be called once and must be called before any log message is created.

class function SetLogger(const ALogger: TLogCallback): Boolean; static

Parameters

ALogger: TLogCallback

Returns

Boolean: True if the logger was set successfully, False otherwise

Remarks

Use SetLoggerUtf8 for a more efficient version that doesn't require UTF-8 conversion.


SetLoggerUtf8(TLogCallbackUtf8)

Sets a custom logger callback. This function can only be called once and must be called before any log message is created.

class function SetLoggerUtf8(const ALogger: TLogCallbackUtf8): Boolean; static

Parameters

ALogger: TLogCallbackUtf8

Returns

Boolean: True if the logger was set successfully, False otherwise


SetLogLevelFromEnvOr(TLogLevel)

Sets the log level from the IOX2_LOG_LEVEL environment variable, or uses the specified level if the variable is not set.

class procedure SetLogLevelFromEnvOr(const ALevel: TLogLevel); static

Parameters

ALevel: TLogLevel : The fallback log level to use if the environment variable is not set


SetLogLevelFromEnvOrDefault

Sets the log level from the IOX2_LOG_LEVEL environment variable, or defaults to Info if the variable is not set.

class procedure SetLogLevelFromEnvOrDefault; static


Write(TLogLevel, String, String)

Writes a log message to the logger.

class procedure Write(const ALogLevel: TLogLevel; const AOrigin, AMessage: String); static

Parameters

ALogLevel: TLogLevel : The severity level of the message

AOrigin: String : The source/origin of the message (can be empty)

AMessage: String : The log message content

Remarks

Use WriteUtf8 for a more efficient version that doesn't require UTF-8 conversion.


WriteUtf8(TLogLevel, UTF8String, UTF8String)

Writes a log message to the logger.

class procedure WriteUtf8(const ALogLevel: TLogLevel; const AOrigin, AMessage: UTF8String); static

Parameters

ALogLevel: TLogLevel : The severity level of the message

AOrigin: UTF8String : The source/origin of the message (can be empty)

AMessage: UTF8String : The log message content