mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 13:07:50 +00:00
[#3569] added comment and unit test for long logger name
This commit is contained in:
parent
9ee776ac7e
commit
cb78c19f53
@ -29,6 +29,13 @@ LegalSyslog::LegalSyslog(const DatabaseConnection::ParameterMap& parameters)
|
||||
LoggingInfo info;
|
||||
// Remove default destinations as we are going to replace them.
|
||||
info.clearDestinations();
|
||||
/// The name of the logger may be no longer than MAX_LOGGER_NAME_SIZE
|
||||
/// else the program will throw an exception. This restriction allows
|
||||
/// loggers to be declared statically: the name is stored in a fixed-size
|
||||
/// array to avoid the need to allocate heap storage during program
|
||||
/// initialization (which causes problems on some operating systems).
|
||||
/// e.g. or error: '<logger-name>' is not a valid name for a logger:
|
||||
/// valid names must be between 1 and 31 characters in length.
|
||||
info.name_ = "legal-log-";
|
||||
info.name_ += boost::lexical_cast<std::string>(reinterpret_cast<uint64_t>(this));
|
||||
logger_.reset(new Logger(info.name_.c_str()));
|
||||
|
@ -157,6 +157,8 @@ public:
|
||||
/// loggers to be declared statically: the name is stored in a fixed-size
|
||||
/// array to avoid the need to allocate heap storage during program
|
||||
/// initialization (which causes problems on some operating systems).
|
||||
/// e.g. or error: '<logger-name>' is not a valid name for a logger:
|
||||
/// valid names must be between 1 and 31 characters in length.
|
||||
///
|
||||
/// \note Note also that there is no constructor taking a std::string. This
|
||||
/// minimizes the possibility of initializing a static logger with a
|
||||
|
@ -63,6 +63,14 @@ public:
|
||||
///
|
||||
/// Creates a logger of the specific name.
|
||||
///
|
||||
/// \note The name of the logger may be no longer than MAX_LOGGER_NAME_SIZE
|
||||
/// else the program will throw an exception. This restriction allows
|
||||
/// loggers to be declared statically: the name is stored in a fixed-size
|
||||
/// array to avoid the need to allocate heap storage during program
|
||||
/// initialization (which causes problems on some operating systems).
|
||||
/// e.g. or error: '<logger-name>' is not a valid name for a logger:
|
||||
/// valid names must be between 1 and 31 characters in length.
|
||||
///
|
||||
/// \param name Name of the logger.
|
||||
LoggerImpl(const std::string& name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user