text stringlengths 0 234 |
|---|
Put_Line("Adding wheel directly to car object."); |
subaru.wheels := subaru.wheels + 1; |
Put("Wheel check: "); |
Put(Integer'Image(subaru.wheels)); |
New_Line; |
Put("Door check: "); |
Put(Integer'Image(subaru.doors)); |
New_Line; |
Put("Cylinder check: "); |
Put(Integer'Image(subaru.cylinders)); |
New_Line; |
New_Line; |
Put_Line("Removing wheel using object method."); |
deleteWheels(subaru, 1); |
Put("Wheel check: "); |
Put(Integer'Image(subaru.wheels)); |
New_Line; |
Put("Door check: "); |
Put(Integer'Image(subaru.doors)); |
New_Line; |
Put("Cylinder check: "); |
Put(Integer'Image(subaru.cylinders)); |
New_Line; |
Function Definition: procedure Free_Logger_Msg_Ptr is new Ada.Unchecked_Deallocation |
Function Body: (Object => Logger_Message_Packet, Name => Logger_Message_Packet_Ptr); |
function Format_Log_Level |
(Use_Color : Boolean; |
Log_Level : Log_Levels) |
return Unbounded_String |
is |
Color_Prefix : Unbounded_String; |
Log_Level_Str : Unbounded_String; |
Now : constant Time := Clock; |
begin |
-- Add ANSI color codes if we're using color on Linux |
if Use_Color |
then |
case Log_Level is |
when EMERGERENCY => |
Color_Prefix := To_Unbounded_String (ANSI_Light_Red); |
when ALERT => |
Color_Prefix := To_Unbounded_String (ANSI_Light_Red); |
when CRITICAL => |
Color_Prefix := To_Unbounded_String (ANSI_Light_Red); |
when ERROR => |
Color_Prefix := To_Unbounded_String (ANSI_Red); |
when WARNING => |
Color_Prefix := To_Unbounded_String (ANSI_Light_Yellow); |
when NOTICE => |
Color_Prefix := To_Unbounded_String (ANSI_Yellow); |
when INFO => |
Color_Prefix := To_Unbounded_String (ANSI_Green); |
when DEBUG => |
Color_Prefix := To_Unbounded_String (ANSI_Light_Blue); |
end case; |
Log_Level_Str := |
Color_Prefix & To_Unbounded_String (Log_Level'Image) & ANSI_Reset; |
else |
Log_Level_Str := To_Unbounded_String (Log_Level'Image); |
end if; |
return To_Unbounded_String |
(Image (Date => Now) & " [" & To_String (Log_Level_Str) & "]"); |
end Format_Log_Level; |
function Create_String_From_Components |
(Components : Component_Vector.Vector) |
return Unbounded_String |
is |
Components_String : Unbounded_String; |
procedure Component_To_String (c : Component_Vector.Cursor) is |
Scratch_String : Unbounded_String; |
begin |
Scratch_String := Components (c); |
Components_String := Components_String & "[" & Scratch_String & "]"; |
end Component_To_String; |
begin |
-- If there's no component, just leave it blank |
if Components.Length = 0 |
then |
return To_Unbounded_String (""); |
end if; |
Components.Iterate (Component_To_String'Access); |
return Components_String; |
end Create_String_From_Components; |
protected body Logger_Queue_Type is |
-- Handles queue of packets for the logger thread |
entry Add_Packet (Queue : Logger_Message_Packet_Ptr) when True is |
begin |
Queued_Packets.Append (Queue); |
end Add_Packet; |
entry Get (Queue : out Logger_Message_Packet_Ptr) |
when Queued_Packets.Length > 0 is |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.