[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNUnet-developers] GNUNET_assert cannot specify component to log fr

From: Florian Dold
Subject: Re: [GNUnet-developers] GNUNET_assert cannot specify component to log from?
Date: Fri, 2 Dec 2016 16:45:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0

On 12/02/2016 09:23 AM, Markus Teich wrote:
> Heyho,
> I can't seem to find any macro in the GNUNET_assert/GNUNET_break family which
> allows me to specify the component used for logging (like with 
> GNUNET_log_from).
> Is this intentional? Is every component expected to define their own assertion
> macros? Why do they exist in the first place then?

Assertions and logging are really in a different category, they don't
quite serve the same purpose.  You don't really need the component since
asserts give you the source file and line already.

Assertions/breaks are supposed to tell you that something's wrong with
your code, while "normal" logging is intended for users and debugging.

If you think that the component is relevant for your log output, it
likely means that you should use GNUNET_log instead of

> Also why does the GNUNET_log family not always end the log message with '\n' 
> as
> a convenience? I could not find a function GNUNET_log_resume or something
> similar which would use that as a feature and not print the log header again.

Mostly so that GNUNET_log behaves like printf, but with a logging header
prepended ;-)

I'm not against changing it, but I also don't really see a big benefit.
If nobody opposes it and you decide to change it, please also change it
in the GNU Taler merchant/exchange repos which depend on GNUnet.

- Florian

reply via email to

[Prev in Thread] Current Thread [Next in Thread]