-- (c) Copyright, Real-Time Innovations, 2025. -- All rights reserved. -- No duplications, whole or partial, manual or electronic, may be made -- without express written permission. Any such copies, or -- revisions thereof, must display this notice unaltered. -- This code contains trade secrets of Real-Time Innovations, Inc. with RTIDDS.Obj_Impl; with Interfaces.C_Streams; with RTIDDS.Low_Level.ndds_ndds_config_c_h; package DDS.Logger is
type Ref (<>) is new RTIDDS.Obj_Impl.Ref with private;
type Ref_Access is access all Ref'Class;
function Get_Instance return Ref_Access;
-- <dref>Logger_get_instance</dref> function Get_Verbosity (This : not null access Ref) return LogVerbosity;
-- <dref>Logger_get_verbosity</dref> function Get_Verbosity (This : not null access Ref;
Category : in LogCategory) return LogVerbosity;
-- <dref>Logger_get_verbosity_by_category</dref> procedure Set_Verbosity (This : not null access Ref;
Verbosity : in LogVerbosity);
-- <dref>Logger_set_verbosity</dref> procedure Set_Verbosity (This : not null access Ref;
Category : in LogCategory;
Verbosity : in LogVerbosity);
-- <dref>Logger_set_verbosity_by_category</dref> function Get_Print_Format (This : not null access Ref) return LogPrintFormat;
-- <dref>Logger_get_print_format</dref> procedure Set_Print_Format (This : not null access Ref; Format : LogPrintFormat);
-- <dref>Logger_set_print_format</dref> function Get_Output_File
(This : not null access Ref) return Interfaces.C_Streams.FILEs;
-- Get the file to which the logged output is redirected. -- If no output file has been registered through set_output_file, -- this function will return NULL. In this case, -- logged output will on most platforms go to standard out. procedure Set_Output_File
(This : not null access Ref; To : Interfaces.C_Streams.FILEs);
-- Set the file to which the logged output is redirected. -- The file passed may be NULL, in which case further logged output -- will be redirected to the platform-specific default output location -- (standard out on most platforms). -- For better performance when log messages are generated frequently, -- the log messages are not flushed into a file immediately after they -- are generated. In other words, while writing a log message, -- RTI Connext only calls the function fwrite() -- (see https://pubs.opengroup.org/onlinepubs/009695399/functions/fwrite.html); -- it does not call the function fflush() -- (see https://pubs.opengroup.org/onlinepubs/009695399/functions/fflush.html). -- If your application requires a different flushing behavior, -- you may use set_output_device to configure a custom logging device. procedure Set_Output_File_Name
(This : not null access Ref; File_Name : Standard.String);
-- Set the name of the file to which the logged output is redirected. -- The name may be NULL, in which case further logged output will be -- redirected to the platform-specific default output location -- (standard out on most platforms). -- See output_file for the flushing behavior. procedure Set_Output_File_Set
(This : not null access Ref;
File_Preffix : Standard.String;
File_Suffix : Standard.String;
Max_Capacity : Natural;
Max_Files : Natural);
-- Configure a set of files to redirect the logged output. -- The logged output will be redirected to a set of files whose names are -- configured with a prefix and a suffix. -- The maximum number of bytes configures how many bytes to write into -- a file before opening the next file. After reaching the maximum number -- of files, the first one is overwritten. -- For example, if the prefix is 'Foo', the suffix is '.txt', -- the max number of bytes is 1GB, and the max number of files is 3, -- the logger will create (at most) these files: -- Foo1.txt, Foo2.txt, and Foo3.txt. -- It will write to Foo1.txt, and after writing 1GB, -- it will move on to Foo2.txt, then to Foo3.txt, then to Foo1.txt again, -- and so on. -- To stop logging to these files and redirect the output to the -- platform-specific location, pass "", "", 0, 0. -- See DDS.Logger.set_output_file for the flushing behavior. type LoggerDevice_Interface is limited interface;
type LoggerDevice_Interface_Access is access all LoggerDevice_Interface'Class;
procedure Write (Self : not null access LoggerDevice_Interface; Text : Standard.String; Level : LogVerbosity) is abstract;
procedure Close (Self : not null access LoggerDevice_Interface) is null;
function GetLogger
(Self : access LoggerDevice_Interface) return DDS.Logger.Ref_Access is abstract;
procedure Set_Output_Device (Self : not null access DDS.Logger.Ref;
Device : access LoggerDevice_Interface'Class);
function GetDevice
(Self : access LoggerDevice_Interface) return access
RTIDDS.Low_Level.ndds_ndds_config_c_h.NDDS_Config_LoggerDevice is abstract;
private type Ref is new RTIDDS.Obj_Impl.Ref with null record;
procedure SetInterface (Self : not null access DDS.Logger.Ref; To : access RTIDDS.Low_Level.ndds_ndds_config_c_h.NDDS_Config_Logger);
function GetInterface (Self : not null access DDS.Logger.Ref) return access RTIDDS.Low_Level.ndds_ndds_config_c_h.NDDS_Config_Logger;
end DDS.Logger;