From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Disabling string evaluation in a logging system
Date: Tue, 18 May 2010 11:17:16 -0700
Date: 2010-05-18T11:17:16-07:00 [thread overview]
Message-ID: <hsuljq$noj$1@tornado.tornevall.net> (raw)
In-Reply-To: <Pine.LNX.4.64.1005181148170.19671@medsec1.medien.uni-weimar.de>
stefan-lucks@see-the.signature wrote:
>
> package Flexi_Log is
>
> procedure Write(Log_Level: Log.Level_Type;
> Message_1: String := "";
> Message_2: String := "";
> Message_3: String := "";
> ...
> Message_9: String := "");
> -- if Log_Level>0 then
> -- Log.Write(Message_1 & Message_2 & ... , Log_Level);
> -- end if;
>
> end Flexi_Log;
>
> In any case, the number of different strings to make one message is
> constant. The constant is under your control, but it is constant. If your
> support goes for up to, say, Message_9, a message for the log which
> consists of 10 or more parts may still trouble you. So change the constant
> sufficiently large that it doesn't trouble you too often ...
You could also do something like:
type Message_List is array (Positive range <>) of Ada.Strings.Unbounded;
procedure Write (Level : Log.Level_ID; Message : Message_List);
-- If Level > No_Logging and Message'Length > 0 then log the concatenation of
-- the strings in Message.
But I don't see that it buys you much, if anything.
Ultimately, this sounds like a case of premature optimization, given that the
string operations are not impacting your timing requirements, according to
another post.
--
Jeff Carter
"You've got the brain of a four-year-old boy,
and I bet he was glad to get rid of it."
Horse Feathers
47
next prev parent reply other threads:[~2010-05-18 18:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 7:48 Disabling string evaluation in a logging system dhenry
2010-05-18 8:15 ` Dmitry A. Kazakov
2010-05-18 8:45 ` Dmitry A. Kazakov
2010-05-18 9:45 ` Cyrille
2010-05-18 10:26 ` Dmitry A. Kazakov
2010-05-18 12:10 ` Georg Bauhaus
2010-05-18 12:15 ` Georg Bauhaus
2010-05-18 12:54 ` Dmitry A. Kazakov
2010-05-18 9:32 ` Gautier write-only
2010-05-18 9:37 ` Gautier write-only
2010-05-18 11:27 ` Gautier write-only
2010-05-18 12:18 ` dhenry
2010-05-19 9:04 ` Stephen Leake
2010-05-19 12:38 ` Dmitry A. Kazakov
2010-05-19 18:02 ` (see below)
2010-05-19 19:08 ` Adam Beneschan
2010-05-18 10:13 ` stefan-lucks
2010-05-18 18:17 ` Jeffrey R. Carter [this message]
2010-05-18 18:40 ` tmoran
2010-05-19 7:47 ` dhenry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox