[bind10-dev] Questions on the Logging API
Stephen Morris
stephen at isc.org
Mon Dec 20 10:36:13 UTC 2010
On 20 Dec 2010, at 03:39, Likun Zhang wrote:
> Hi stephen,
> Some feedback for reference.
>
>> 1. In C++, should the symbols be "const char*" or should they be numbers?
>
> I would like 'const char*' with some meaningful names, so that when reading
> the code, we don't have to go back to message definition file to check what
> it means.
Although you would still have to examine the header file where the symbols are defined - as opposed to the message file - to see the text of the message.
>> 2. Should we use this scheme for C++ exception messages?
>>
>> If so, we would need to change the way exceptions are thrown. At present we
>> have:
>>
>> isc_throw(exception_class, stream)
>>
>> . where "stream" can be output with a construct of the form "oss << stream".
>> This has allowed us to write things like:
>>
>> isc_throw(InvalidTime, "Invalid " << valname << "value: " << value);
>>
>> With an external message file we would need to move away from the stream
>> format (as it allows the splitting a the text of a message into multiple fragments,
>> e.g. "Invalid" and "value: " in the example above) and instead write something
>> like:
>>
>> isc_throw(InvalidTime, INVALTIME, valname, value)
>>
>> Is this a change we want to make?
>
> Maybe it depends,
> Depends on whether the message is useful to the users. If an exception is
> thrown and caught properly, it should be treated as some error message.
> If bind10 refuses to work because the exception, the user should report the
> bug to bind10-dev list, I don't think the user really want to know what the
> message really mean. Like my windows os, it's chinese version, but I never
> get an chinese error message when blue screen occurs to me, I just restart
> my computer.
That is a fair point - although we then have two systems:
1) a symbolic name plus local text for non-fatal messages
2) a string of English text for fatal messages
I think it would look better if there was consistency.
Stephen
Stephen
More information about the bind10-dev
mailing list