BIND 10 trac1040, updated. d4ef4b9a0cc72eb9d85c6fef4aeb4b2f90b2b590 [trac1040] Put messages into alphabetical order
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jun 22 12:40:53 UTC 2011
The branch, trac1040 has been updated
via d4ef4b9a0cc72eb9d85c6fef4aeb4b2f90b2b590 (commit)
via e560672e5119540d6e6860c177a9b969e5a71fb1 (commit)
via ebc9aa4dc554ec8aced4413b47a0668f3f5f1da1 (commit)
via ddd40bde5412d11fb4d320958f26572797442b74 (commit)
via 4565ca4899e702da0c515e11d614cddb3f483a7d (commit)
from 6722a4d52b519ed768fa70b31cdd10da868cacbc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d4ef4b9a0cc72eb9d85c6fef4aeb4b2f90b2b590
Author: Stephen Morris <stephen at isc.org>
Date: Wed Jun 22 11:55:17 2011 +0100
[trac1040] Put messages into alphabetical order
... and remove the now-redundant spaces between the message ID and
the text of the message. (With the expansion of message IDs, the
alignment of the text within the file was destroyed.)
commit e560672e5119540d6e6860c177a9b969e5a71fb1
Author: Stephen Morris <stephen at isc.org>
Date: Wed Jun 22 11:47:01 2011 +0100
[trac1040] Expand message IDs into words separated by underscores
Also change prefix from MSG_ (which is not specific) to LOG_ (which
identifies the messages as part of the logging code).
commit ebc9aa4dc554ec8aced4413b47a0668f3f5f1da1
Author: Stephen Morris <stephen at isc.org>
Date: Wed Jun 22 10:57:42 2011 +0100
[trac1040] Expand logger implementation message code names
Altered the message code names in the logger implementation messages
to be in the form of words separated by underscores. Also updated
some of the descriptions at the same time.
commit ddd40bde5412d11fb4d320958f26572797442b74
Author: Stephen Morris <stephen at isc.org>
Date: Wed Jun 22 10:46:20 2011 +0100
[trac1040] Remove $PREFIX directive
commit 4565ca4899e702da0c515e11d614cddb3f483a7d
Author: Stephen Morris <stephen at isc.org>
Date: Wed Jun 22 10:42:05 2011 +0100
[trac1040] Renamed xxxdef.mes files to xxx_messages.mes
Note: impldef.mes was renamed to logimpl_messages.mes to better
reflect the contents.
-----------------------------------------------------------------------
Summary of changes:
src/lib/log/Makefile.am | 8 +-
src/lib/log/compiler/message.cc | 10 +-
src/lib/log/impldef.cc | 29 ------
src/lib/log/impldef.h | 18 ----
src/lib/log/impldef.mes | 38 --------
src/lib/log/log_messages.cc | 63 +++++++++++++
src/lib/log/log_messages.h | 35 +++++++
src/lib/log/{messagedef.mes => log_messages.mes} | 105 +++++++++++-----------
src/lib/log/logger_level.cc | 4 +-
src/lib/log/logger_level_impl.cc | 8 +-
src/lib/log/logger_manager.cc | 15 ++--
src/lib/log/logger_manager_impl.cc | 14 ++--
src/lib/log/logimpl_messages.cc | 29 ++++++
src/lib/log/logimpl_messages.h | 18 ++++
src/lib/log/logimpl_messages.mes | 43 +++++++++
src/lib/log/message_reader.cc | 28 +++---
src/lib/log/messagedef.cc | 63 -------------
src/lib/log/messagedef.h | 35 -------
src/lib/log/output_option.cc | 11 ++-
src/lib/log/tests/destination_test.sh.in | 24 +++---
src/lib/log/tests/local_file_test.sh.in | 39 ++++----
src/lib/log/tests/logger_example.cc | 32 ++++----
src/lib/log/tests/logger_level_unittest.cc | 2 +-
src/lib/log/tests/logger_manager_unittest.cc | 38 ++++----
src/lib/log/tests/logger_unittest.cc | 2 +-
src/lib/log/tests/message_dictionary_unittest.cc | 4 +-
src/lib/log/tests/message_reader_unittest.cc | 24 +++---
src/lib/log/tests/severity_test.sh.in | 52 ++++++------
28 files changed, 397 insertions(+), 394 deletions(-)
delete mode 100644 src/lib/log/impldef.cc
delete mode 100644 src/lib/log/impldef.h
delete mode 100644 src/lib/log/impldef.mes
create mode 100644 src/lib/log/log_messages.cc
create mode 100644 src/lib/log/log_messages.h
rename src/lib/log/{messagedef.mes => log_messages.mes} (80%)
create mode 100644 src/lib/log/logimpl_messages.cc
create mode 100644 src/lib/log/logimpl_messages.h
create mode 100644 src/lib/log/logimpl_messages.mes
delete mode 100644 src/lib/log/messagedef.cc
delete mode 100644 src/lib/log/messagedef.h
-----------------------------------------------------------------------
diff --git a/src/lib/log/Makefile.am b/src/lib/log/Makefile.am
index 7833e0d..63b1dfb 100644
--- a/src/lib/log/Makefile.am
+++ b/src/lib/log/Makefile.am
@@ -8,7 +8,7 @@ CLEANFILES = *.gcno *.gcda
lib_LTLIBRARIES = liblog.la
liblog_la_SOURCES =
liblog_la_SOURCES += dummylog.h dummylog.cc
-liblog_la_SOURCES += impldef.cc impldef.h
+liblog_la_SOURCES += logimpl_messages.cc logimpl_messages.h
liblog_la_SOURCES += log_formatter.h log_formatter.cc
liblog_la_SOURCES += logger.cc logger.h
liblog_la_SOURCES += logger_impl.cc logger_impl.h
@@ -21,7 +21,7 @@ liblog_la_SOURCES += logger_name.cc logger_name.h
liblog_la_SOURCES += logger_specification.h
liblog_la_SOURCES += logger_support.cc logger_support.h
liblog_la_SOURCES += macros.h
-liblog_la_SOURCES += messagedef.cc messagedef.h
+liblog_la_SOURCES += log_messages.cc log_messages.h
liblog_la_SOURCES += message_dictionary.cc message_dictionary.h
liblog_la_SOURCES += message_exception.h
liblog_la_SOURCES += message_initializer.cc message_initializer.h
@@ -30,8 +30,8 @@ liblog_la_SOURCES += message_types.h
liblog_la_SOURCES += output_option.cc output_option.h
EXTRA_DIST = README
-EXTRA_DIST += impldef.mes
-EXTRA_DIST += messagedef.mes
+EXTRA_DIST += logimpl_messages.mes
+EXTRA_DIST += log_messages.mes
# Note: the ordering matters: -Wno-... must follow -Wextra (defined in
# B10_CXXFLAGS)
diff --git a/src/lib/log/compiler/message.cc b/src/lib/log/compiler/message.cc
index 53a24ee..68335dc 100644
--- a/src/lib/log/compiler/message.cc
+++ b/src/lib/log/compiler/message.cc
@@ -28,10 +28,10 @@
#include <util/filename.h>
#include <util/strutil.h>
+#include <log/log_messages.h>
#include <log/message_dictionary.h>
#include <log/message_exception.h>
#include <log/message_reader.h>
-#include <log/messagedef.h>
#include <log/logger.h>
@@ -306,7 +306,7 @@ writeHeaderFile(const string& file, const vector<string>& ns_components,
ofstream hfile(header_file.fullName().c_str());
if (hfile.fail()) {
- throw MessageException(MSG_OPENOUT, header_file.fullName(),
+ throw MessageException(LOG_OPEN_OUTPUT_FAIL, header_file.fullName(),
strerror(errno));
}
@@ -340,7 +340,7 @@ writeHeaderFile(const string& file, const vector<string>& ns_components,
// Report errors (if any) and exit
if (hfile.fail()) {
- throw MessageException(MSG_WRITERR, header_file.fullName(),
+ throw MessageException(LOG_WRITE_ERROR, header_file.fullName(),
strerror(errno));
}
@@ -394,7 +394,7 @@ writeProgramFile(const string& file, const vector<string>& ns_components,
ofstream ccfile(program_file.fullName().c_str());
if (ccfile.fail()) {
- throw MessageException(MSG_OPENOUT, program_file.fullName(),
+ throw MessageException(LOG_OPEN_OUTPUT_FAIL, program_file.fullName(),
strerror(errno));
}
@@ -452,7 +452,7 @@ writeProgramFile(const string& file, const vector<string>& ns_components,
// Report errors (if any) and exit
if (ccfile.fail()) {
- throw MessageException(MSG_WRITERR, program_file.fullName(),
+ throw MessageException(LOG_WRITE_ERROR, program_file.fullName(),
strerror(errno));
}
diff --git a/src/lib/log/impldef.cc b/src/lib/log/impldef.cc
deleted file mode 100644
index 087ebea..0000000
--- a/src/lib/log/impldef.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// File created from impldef.mes on Wed Jun 1 10:32:57 2011
-
-#include <cstddef>
-#include <log/message_types.h>
-#include <log/message_initializer.h>
-
-namespace isc {
-namespace log {
-
-extern const isc::log::MessageID LOGIMPL_ABOVEDBGMAX = "LOGIMPL_ABOVEDBGMAX";
-extern const isc::log::MessageID LOGIMPL_BADDEBUG = "LOGIMPL_BADDEBUG";
-extern const isc::log::MessageID LOGIMPL_BELOWDBGMIN = "LOGIMPL_BELOWDBGMIN";
-
-} // namespace log
-} // namespace isc
-
-namespace {
-
-const char* values[] = {
- "LOGIMPL_ABOVEDBGMAX", "debug level of %1 is too high and will be set to the maximum of %2",
- "LOGIMPL_BADDEBUG", "debug string is '%1': must be of the form DEBUGn",
- "LOGIMPL_BELOWDBGMIN", "debug level of %1 is too low and will be set to the minimum of %2",
- NULL
-};
-
-const isc::log::MessageInitializer initializer(values);
-
-} // Anonymous namespace
-
diff --git a/src/lib/log/impldef.h b/src/lib/log/impldef.h
deleted file mode 100644
index 7c70996..0000000
--- a/src/lib/log/impldef.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// File created from impldef.mes on Wed Jun 1 10:32:57 2011
-
-#ifndef __IMPLDEF_H
-#define __IMPLDEF_H
-
-#include <log/message_types.h>
-
-namespace isc {
-namespace log {
-
-extern const isc::log::MessageID LOGIMPL_ABOVEDBGMAX;
-extern const isc::log::MessageID LOGIMPL_BADDEBUG;
-extern const isc::log::MessageID LOGIMPL_BELOWDBGMIN;
-
-} // namespace log
-} // namespace isc
-
-#endif // __IMPLDEF_H
diff --git a/src/lib/log/impldef.mes b/src/lib/log/impldef.mes
deleted file mode 100644
index 93e9fab..0000000
--- a/src/lib/log/impldef.mes
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# \brief Logger Implementation Messages
-#
-# This holds messages generated by the underlying logger implementation. They
-# are likely to be specific to that implementation, and may well change if the
-# underlying implementation is changed. For that reason, they have been put
-# in a separate file.
-
-$PREFIX LOGIMPL_
-$NAMESPACE isc::log
-
-% ABOVEDBGMAX debug level of %1 is too high and will be set to the maximum of %2
-A message from the underlying logger implementation code, the debug level
-(as set by the string DEBGUGn) is above the maximum allowed value and has
-been reduced to that value.
-
-% BADDEBUG debug string is '%1': must be of the form DEBUGn
-The string indicating the extended logging level (used by the underlying
-logger implementation code) is not of the stated form. In particular,
-it starts DEBUG but does not end with an integer.
-
-% BELOWDBGMIN debug level of %1 is too low and will be set to the minimum of %2
-A message from the underlying logger implementation code, the debug level
-(as set by the string DEBGUGn) is below the minimum allowed value and has
-been increased to that value.
diff --git a/src/lib/log/log_messages.cc b/src/lib/log/log_messages.cc
new file mode 100644
index 0000000..a515959
--- /dev/null
+++ b/src/lib/log/log_messages.cc
@@ -0,0 +1,63 @@
+// File created from log_messages.mes on Wed Jun 22 11:54:57 2011
+
+#include <cstddef>
+#include <log/message_types.h>
+#include <log/message_initializer.h>
+
+namespace isc {
+namespace log {
+
+extern const isc::log::MessageID LOG_BAD_DESTINATION = "LOG_BAD_DESTINATION";
+extern const isc::log::MessageID LOG_BAD_SEVERITY = "LOG_BAD_SEVERITY";
+extern const isc::log::MessageID LOG_BAD_STREAM = "LOG_BAD_STREAM";
+extern const isc::log::MessageID LOG_DUPLICATE_MESSAGE_ID = "LOG_DUPLICATE_MESSAGE_ID";
+extern const isc::log::MessageID LOG_DUPLICATE_NAMESPACE = "LOG_DUPLICATE_NAMESPACE";
+extern const isc::log::MessageID LOG_INPUT_OPEN_FAIL = "LOG_INPUT_OPEN_FAIL";
+extern const isc::log::MessageID LOG_INVALID_MESSAGE_ID = "LOG_INVALID_MESSAGE_ID";
+extern const isc::log::MessageID LOG_NAMESPACE_EXTRA_ARGS = "LOG_NAMESPACE_EXTRA_ARGS";
+extern const isc::log::MessageID LOG_NAMESPACE_INVALID_ARG = "LOG_NAMESPACE_INVALID_ARG";
+extern const isc::log::MessageID LOG_NAMESPACE_NO_ARGS = "LOG_NAMESPACE_NO_ARGS";
+extern const isc::log::MessageID LOG_NO_MESSAGE_ID = "LOG_NO_MESSAGE_ID";
+extern const isc::log::MessageID LOG_NO_MESSAGE_TEXT = "LOG_NO_MESSAGE_TEXT";
+extern const isc::log::MessageID LOG_NO_SUCH_MESSAGE = "LOG_NO_SUCH_MESSAGE";
+extern const isc::log::MessageID LOG_OPEN_OUTPUT_FAIL = "LOG_OPEN_OUTPUT_FAIL";
+extern const isc::log::MessageID LOG_PREFIX_EXTRA_ARGS = "LOG_PREFIX_EXTRA_ARGS";
+extern const isc::log::MessageID LOG_PREFIX_INVALID_ARG = "LOG_PREFIX_INVALID_ARG";
+extern const isc::log::MessageID LOG_READING_LOCAL_FILE = "LOG_READING_LOCAL_FILE";
+extern const isc::log::MessageID LOG_READ_ERROR = "LOG_READ_ERROR";
+extern const isc::log::MessageID LOG_UNRECOGNISED_DIRECTIVE = "LOG_UNRECOGNISED_DIRECTIVE";
+extern const isc::log::MessageID LOG_WRITE_ERROR = "LOG_WRITE_ERROR";
+
+} // namespace log
+} // namespace isc
+
+namespace {
+
+const char* values[] = {
+ "LOG_BAD_DESTINATION", "unrecognized log destination: %1",
+ "LOG_BAD_SEVERITY", "unrecognized log severity: %1",
+ "LOG_BAD_STREAM", "bad log console output stream: %1",
+ "LOG_DUPLICATE_MESSAGE_ID", "duplicate message ID (%1) in compiled code",
+ "LOG_DUPLICATE_NAMESPACE", "line %1: duplicate $NAMESPACE directive found",
+ "LOG_INPUT_OPEN_FAIL", "unable to open message file %1 for input: %2",
+ "LOG_INVALID_MESSAGE_ID", "line %1: invalid message identification '%2'",
+ "LOG_NAMESPACE_EXTRA_ARGS", "line %1: $NAMESPACE directive has too many arguments",
+ "LOG_NAMESPACE_INVALID_ARG", "line %1: $NAMESPACE directive has an invalid argument ('%2')",
+ "LOG_NAMESPACE_NO_ARGS", "line %1: no arguments were given to the $NAMESPACE directive",
+ "LOG_NO_MESSAGE_ID", "line %1: message definition line found without a message ID",
+ "LOG_NO_MESSAGE_TEXT", "line %1: line found containing a message ID ('%2') and no text",
+ "LOG_NO_SUCH_MESSAGE", "could not replace message text for '%1': no such message",
+ "LOG_OPEN_OUTPUT_FAIL", "unable to open %1 for output: %2",
+ "LOG_PREFIX_EXTRA_ARGS", "line %1: $PREFIX directive has too many arguments",
+ "LOG_PREFIX_INVALID_ARG", "line %1: $PREFIX directive has an invalid argument ('%2')",
+ "LOG_READING_LOCAL_FILE", "reading local message file %1",
+ "LOG_READ_ERROR", "error reading from message file %1: %2",
+ "LOG_UNRECOGNISED_DIRECTIVE", "line %1: unrecognised directive '%2'",
+ "LOG_WRITE_ERROR", "error writing to %1: %2",
+ NULL
+};
+
+const isc::log::MessageInitializer initializer(values);
+
+} // Anonymous namespace
+
diff --git a/src/lib/log/log_messages.h b/src/lib/log/log_messages.h
new file mode 100644
index 0000000..476f686
--- /dev/null
+++ b/src/lib/log/log_messages.h
@@ -0,0 +1,35 @@
+// File created from log_messages.mes on Wed Jun 22 11:54:57 2011
+
+#ifndef __LOG_MESSAGES_H
+#define __LOG_MESSAGES_H
+
+#include <log/message_types.h>
+
+namespace isc {
+namespace log {
+
+extern const isc::log::MessageID LOG_BAD_DESTINATION;
+extern const isc::log::MessageID LOG_BAD_SEVERITY;
+extern const isc::log::MessageID LOG_BAD_STREAM;
+extern const isc::log::MessageID LOG_DUPLICATE_MESSAGE_ID;
+extern const isc::log::MessageID LOG_DUPLICATE_NAMESPACE;
+extern const isc::log::MessageID LOG_INPUT_OPEN_FAIL;
+extern const isc::log::MessageID LOG_INVALID_MESSAGE_ID;
+extern const isc::log::MessageID LOG_NAMESPACE_EXTRA_ARGS;
+extern const isc::log::MessageID LOG_NAMESPACE_INVALID_ARG;
+extern const isc::log::MessageID LOG_NAMESPACE_NO_ARGS;
+extern const isc::log::MessageID LOG_NO_MESSAGE_ID;
+extern const isc::log::MessageID LOG_NO_MESSAGE_TEXT;
+extern const isc::log::MessageID LOG_NO_SUCH_MESSAGE;
+extern const isc::log::MessageID LOG_OPEN_OUTPUT_FAIL;
+extern const isc::log::MessageID LOG_PREFIX_EXTRA_ARGS;
+extern const isc::log::MessageID LOG_PREFIX_INVALID_ARG;
+extern const isc::log::MessageID LOG_READING_LOCAL_FILE;
+extern const isc::log::MessageID LOG_READ_ERROR;
+extern const isc::log::MessageID LOG_UNRECOGNISED_DIRECTIVE;
+extern const isc::log::MessageID LOG_WRITE_ERROR;
+
+} // namespace log
+} // namespace isc
+
+#endif // __LOG_MESSAGES_H
diff --git a/src/lib/log/log_messages.mes b/src/lib/log/log_messages.mes
new file mode 100644
index 0000000..54e442d
--- /dev/null
+++ b/src/lib/log/log_messages.mes
@@ -0,0 +1,130 @@
+# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# \brief Message Utility Message File
+#
+# This is the source of the set of messages generated by the message and
+# logging components. The associated .h and .cc files are created by hand from
+# this file though and are not built during the build process; this is to avoid
+# the chicken-and-egg situation where we need the files to build the message
+# compiler, yet we need the compiler to build the files.
+
+$NAMESPACE isc::log
+
+% LOG_BAD_DESTINATION unrecognized log destination: %1
+A logger destination value was given that was not recognized. The
+destination should be one of "console", "file", or "syslog".
+
+% LOG_BAD_SEVERITY unrecognized log severity: %1
+A logger severity value was given that was not recognized. The severity
+should be one of "DEBUG", "INFO", "WARN", "ERROR", or "FATAL".
+
+% LOG_BAD_STREAM bad log console output stream: %1
+A log console output stream was given that was not recognized. The
+output stream should be one of "stdout", or "stderr"
+
+% LOG_DUPLICATE_MESSAGE_ID duplicate message ID (%1) in compiled code
+Indicative of a programming error, when it started up, BIND10 detected that
+the given message ID had been registered by one or more modules. (All message
+IDs should be unique throughout BIND10.) This has no impact on the operation
+of the server other that erroneous messages may be logged. (When BIND10 loads
+the message IDs (and their associated text), if a duplicate ID is found it is
+discarded. However, when the module that supplied the duplicate ID logs that
+particular message, the text supplied by the module that added the original
+ID will be output - something that may bear no relation to the condition being
+logged.
+
+% LOG_DUPLICATE_NAMESPACE line %1: duplicate $NAMESPACE directive found
+When reading a message file, more than one $NAMESPACE directive was found. In
+this version of the code, such a condition is regarded as an error and the
+read will be abandoned.
+
+% LOG_INPUT_OPEN_FAIL unable to open message file %1 for input: %2
+The program was not able to open the specified input message file for the
+reason given.
+
+% LOG_INVALID_MESSAGE_ID line %1: invalid message identification '%2'
+The concatenation of the prefix and the message identification is used as
+a symbol in the C++ module; as such it may only contain
+
+% LOG_NAMESPACE_EXTRA_ARGS line %1: $NAMESPACE directive has too many arguments
+The $NAMESPACE directive takes a single argument, a namespace in which all the
+generated symbol names are placed. This error is generated when the
+compiler finds a $NAMESPACE directive with more than one argument.
+
+% LOG_NAMESPACE_INVALID_ARG line %1: $NAMESPACE directive has an invalid argument ('%2')
+The $NAMESPACE argument should be a valid C++ namespace. The reader does a
+cursory check on its validity, checking that the characters in the namespace
+are correct. The error is generated when the reader finds an invalid
+character. (Valid are alphanumeric characters, underscores and colons.)
+
+% LOG_NAMESPACE_NO_ARGS line %1: no arguments were given to the $NAMESPACE directive
+The $NAMESPACE directive takes a single argument, a namespace in which all the
+generated symbol names are placed. This error is generated when the
+compiler finds a $NAMESPACE directive with no arguments.
+
+% LOG_NO_MESSAGE_ID line %1: message definition line found without a message ID
+Message definition lines are lines starting with a "%". The rest of the line
+should comprise the message ID and text describing the message. This error
+indicates the message compiler found a line in the message file comprising
+just the "%" and nothing else.
+
+% LOG_NO_MESSAGE_TEXT line %1: line found containing a message ID ('%2') and no text
+Message definition lines are lines starting with a "%". The rest of the line
+should comprise the message ID and text describing the message. This error
+is generated when a line is found in the message file that contains the
+leading "%" and the message identification but no text.
+
+% LOG_NO_SUCH_MESSAGE could not replace message text for '%1': no such message
+During start-up a local message file was read. A line with the listed
+message identification was found in the file, but the identification is not
+one contained in the compiled-in message dictionary. Either the message
+identification has been mis-spelled in the file, or the local file was used
+for an earlier version of the software and the message with that
+identification has been removed.
+
+This message may appear a number of times in the file, once for every such
+unknown message identification.
+
+% LOG_OPEN_OUTPUT_FAIL unable to open %1 for output: %2
+The program was not able to open the specified output file for the reason
+given.
+
+% LOG_PREFIX_EXTRA_ARGS line %1: $PREFIX directive has too many arguments
+The $PREFIX directive takes a single argument, a prefix to be added to the
+symbol names when a C++ .h file is created. This error is generated when the
+compiler finds a $PREFIX directive with more than one argument.
+
+% LOG_PREFIX_INVALID_ARG line %1: $PREFIX directive has an invalid argument ('%2')
+The $PREFIX argument is used in a symbol name in a C++ header file. As such,
+it must adhere to restrictions on C++ symbol names (e.g. may only contain
+alphanumeric characters or underscores, and may nor start with a digit).
+A $PREFIX directive was found with an argument (given in the message) that
+violates those restictions.
+
+% LOG_READING_LOCAL_FILE reading local message file %1
+This is an informational message output by BIND10 when it starts to read a
+local message file. (A local message file may replace the text of one of more
+messages; the ID of the message will not be changed though.)
+
+% LOG_READ_ERROR error reading from message file %1: %2
+The specified error was encountered reading from the named message file.
+
+% LOG_UNRECOGNISED_DIRECTIVE line %1: unrecognised directive '%2'
+A line starting with a dollar symbol was found, but the first word on the line
+(shown in the message) was not a recognised message compiler directive.
+
+% LOG_WRITE_ERROR error writing to %1: %2
+The specified error was encountered by the message compiler when writing to
+the named output file.
diff --git a/src/lib/log/logger_level.cc b/src/lib/log/logger_level.cc
index 5f74eb3..abac5be 100644
--- a/src/lib/log/logger_level.cc
+++ b/src/lib/log/logger_level.cc
@@ -14,7 +14,7 @@
#include <log/logger_level.h>
#include <log/macros.h>
-#include <log/messagedef.h>
+#include <log/log_messages.h>
#include <boost/algorithm/string.hpp>
@@ -38,7 +38,7 @@ getSeverity(const std::string& sev_str) {
return isc::log::NONE;
} else {
Logger logger("log");
- LOG_ERROR(logger, MSG_BADSEVERITY).arg(sev_str);
+ LOG_ERROR(logger, LOG_BAD_SEVERITY).arg(sev_str);
return isc::log::INFO;
}
}
diff --git a/src/lib/log/logger_level_impl.cc b/src/lib/log/logger_level_impl.cc
index d6d8ed7..397f6d4 100644
--- a/src/lib/log/logger_level_impl.cc
+++ b/src/lib/log/logger_level_impl.cc
@@ -19,9 +19,9 @@
#include <log4cplus/logger.h>
-#include <log/impldef.h>
#include <log/logger_level.h>
#include <log/logger_level_impl.h>
+#include <log/logimpl_messages.h>
#include <log/macros.h>
using namespace log4cplus;
@@ -157,12 +157,12 @@ LoggerLevelImpl::logLevelFromString(const log4cplus::tstring& level) {
try {
int dbglevel = boost::lexical_cast<int>(name.substr(5));
if (dbglevel < MIN_DEBUG_LEVEL) {
- LOG_WARN(logger, LOGIMPL_BELOWDBGMIN).arg(dbglevel)
+ LOG_WARN(logger, LOGIMPL_BELOW_MIN_DEBUG).arg(dbglevel)
.arg(MIN_DEBUG_LEVEL);
dbglevel = MIN_DEBUG_LEVEL;
} else if (dbglevel > MAX_DEBUG_LEVEL) {
- LOG_WARN(logger, LOGIMPL_ABOVEDBGMAX).arg(dbglevel)
+ LOG_WARN(logger, LOGIMPL_ABOVE_MAX_DEBUG).arg(dbglevel)
.arg(MAX_DEBUG_LEVEL);
dbglevel = MAX_DEBUG_LEVEL;
@@ -170,7 +170,7 @@ LoggerLevelImpl::logLevelFromString(const log4cplus::tstring& level) {
return convertFromBindLevel(Level(DEBUG, dbglevel));
}
catch (boost::bad_lexical_cast&) {
- LOG_ERROR(logger, LOGIMPL_BADDEBUG).arg(name);
+ LOG_ERROR(logger, LOGIMPL_BAD_DEBUG_STRING).arg(name);
return (NOT_SET_LOG_LEVEL);
}
}
diff --git a/src/lib/log/logger_manager.cc b/src/lib/log/logger_manager.cc
index 9955a83..4707294 100644
--- a/src/lib/log/logger_manager.cc
+++ b/src/lib/log/logger_manager.cc
@@ -16,18 +16,17 @@
#include <vector>
#include <log/logger.h>
-#include <log/logger_manager_impl.h>
#include <log/logger_manager.h>
+#include <log/logger_manager_impl.h>
#include <log/logger_name.h>
-#include <log/messagedef.h>
+#include <log/log_messages.h>
+#include <log/macros.h>
#include <log/message_dictionary.h>
#include <log/message_exception.h>
#include <log/message_initializer.h>
+#include <log/message_initializer.h>
#include <log/message_reader.h>
#include <log/message_types.h>
-#include <log/macros.h>
-#include <log/messagedef.h>
-#include <log/message_initializer.h>
using namespace std;
@@ -123,7 +122,7 @@ LoggerManager::init(const std::string& root, isc::log::Severity severity,
sort(duplicates.begin(), duplicates.end());
for (vector<string>::iterator i = duplicates.begin();
i != duplicates.end(); ++i) {
- LOG_WARN(logger, MSG_DUPMSGID).arg(*i);
+ LOG_WARN(logger, LOG_DUPLICATE_MESSAGE_ID).arg(*i);
}
}
@@ -145,7 +144,7 @@ LoggerManager::readLocalMessageFile(const char* file) {
MessageReader reader(&dictionary);
try {
- logger.info(MSG_RDLOCMES).arg(file);
+ logger.info(LOG_READING_LOCAL_FILE).arg(file);
reader.readFile(file, MessageReader::REPLACE);
// File successfully read. As each message in the file is supposed to
@@ -156,7 +155,7 @@ LoggerManager::readLocalMessageFile(const char* file) {
for (MessageReader::MessageIDCollection::const_iterator
i = unknown.begin(); i != unknown.end(); ++i) {
string message_id = boost::lexical_cast<string>(*i);
- logger.warn(MSG_IDNOTFND).arg(message_id);
+ logger.warn(LOG_NO_SUCH_MESSAGE).arg(message_id);
}
}
catch (MessageException& e) {
diff --git a/src/lib/log/logger_manager_impl.cc b/src/lib/log/logger_manager_impl.cc
index 92806d0..d69cec8 100644
--- a/src/lib/log/logger_manager_impl.cc
+++ b/src/lib/log/logger_manager_impl.cc
@@ -21,13 +21,13 @@
#include <log4cplus/fileappender.h>
#include <log4cplus/syslogappender.h>
-#include "log/logger.h"
-#include "log/logger_level_impl.h"
-#include "log/logger_manager.h"
-#include "log/logger_manager_impl.h"
-#include "log/logger_name.h"
-#include "log/logger_specification.h"
-#include "log/messagedef.h"
+#include <log/logger.h>
+#include <log/logger_level_impl.h>
+#include <log/logger_manager.h>
+#include <log/logger_manager_impl.h>
+#include <log/log_messages.h>
+#include <log/logger_name.h>
+#include <log/logger_specification.h>
using namespace std;
diff --git a/src/lib/log/logimpl_messages.cc b/src/lib/log/logimpl_messages.cc
new file mode 100644
index 0000000..ca8552e
--- /dev/null
+++ b/src/lib/log/logimpl_messages.cc
@@ -0,0 +1,29 @@
+// File created from logimpl_messages.mes on Wed Jun 22 10:57:02 2011
+
+#include <cstddef>
+#include <log/message_types.h>
+#include <log/message_initializer.h>
+
+namespace isc {
+namespace log {
+
+extern const isc::log::MessageID LOGIMPL_ABOVE_MAX_DEBUG = "LOGIMPL_ABOVE_MAX_DEBUG";
+extern const isc::log::MessageID LOGIMPL_BAD_DEBUG_STRING = "LOGIMPL_BAD_DEBUG_STRING";
+extern const isc::log::MessageID LOGIMPL_BELOW_MIN_DEBUG = "LOGIMPL_BELOW_MIN_DEBUG";
+
+} // namespace log
+} // namespace isc
+
+namespace {
+
+const char* values[] = {
+ "LOGIMPL_ABOVE_MAX_DEBUG", "debug level of %1 is too high and will be set to the maximum of %2",
+ "LOGIMPL_BAD_DEBUG_STRING", "debug string '%1' has invalid format",
+ "LOGIMPL_BELOW_MIN_DEBUG", "debug level of %1 is too low and will be set to the minimum of %2",
+ NULL
+};
+
+const isc::log::MessageInitializer initializer(values);
+
+} // Anonymous namespace
+
diff --git a/src/lib/log/logimpl_messages.h b/src/lib/log/logimpl_messages.h
new file mode 100644
index 0000000..1b94838
--- /dev/null
+++ b/src/lib/log/logimpl_messages.h
@@ -0,0 +1,18 @@
+// File created from logimpl_messages.mes on Wed Jun 22 10:57:02 2011
+
+#ifndef __LOGIMPL_MESSAGES_H
+#define __LOGIMPL_MESSAGES_H
+
+#include <log/message_types.h>
+
+namespace isc {
+namespace log {
+
+extern const isc::log::MessageID LOGIMPL_ABOVE_MAX_DEBUG;
+extern const isc::log::MessageID LOGIMPL_BAD_DEBUG_STRING;
+extern const isc::log::MessageID LOGIMPL_BELOW_MIN_DEBUG;
+
+} // namespace log
+} // namespace isc
+
+#endif // __LOGIMPL_MESSAGES_H
diff --git a/src/lib/log/logimpl_messages.mes b/src/lib/log/logimpl_messages.mes
new file mode 100644
index 0000000..c40f80c
--- /dev/null
+++ b/src/lib/log/logimpl_messages.mes
@@ -0,0 +1,43 @@
+# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# \brief Logger Implementation Messages
+#
+# This holds messages generated by the underlying logger implementation. They
+# are likely to be specific to that implementation, and may well change if the
+# underlying implementation is changed. For that reason, they have been put
+# in a separate file.
+
+$NAMESPACE isc::log
+
+% LOGIMPL_ABOVE_MAX_DEBUG debug level of %1 is too high and will be set to the maximum of %2
+A message from the interface to the underlying logger implementation reporting
+that the debug level (as set by an internally-created string DEBUGn, where n
+is an integer, e.g. DEBUG22) is above the maximum allowed value and has
+been reduced to that value. The appearance of this message may indicate
+a programming error - please submit a bug report.
+
+% LOGIMPL_BAD_DEBUG_STRING debug string '%1' has invalid format
+A message from the interface to the underlying logger implementation
+reporting that an internally-created string used to set the debug level
+is not of the correct format (it should be of the form DEBUGn, where n
+is an integer, e.g. DEBUG22). The appearance of this message indicates
+a programming error - please submit a bug report.
+
+% LOGIMPL_BELOW_MIN_DEBUG debug level of %1 is too low and will be set to the minimum of %2
+A message from the interface to the underlying logger implementation reporting
+that the debug level (as set by an internally-created string DEBUGn, where n
+is an integer, e.g. DEBUG22) is below the minimum allowed value and has
+been increased to that value. The appearance of this message may indicate
+a programming error - please submit a bug report.
diff --git a/src/lib/log/message_reader.cc b/src/lib/log/message_reader.cc
index 1a0b242..2710ab8 100644
--- a/src/lib/log/message_reader.cc
+++ b/src/lib/log/message_reader.cc
@@ -20,8 +20,8 @@
#include <iostream>
#include <fstream>
+#include <log/log_messages.h>
#include <log/message_exception.h>
-#include <log/messagedef.h>
#include <log/message_reader.h>
#include <util/strutil.h>
@@ -48,7 +48,7 @@ MessageReader::readFile(const string& file, MessageReader::Mode mode) {
// Open the file.
ifstream infile(file.c_str());
if (infile.fail()) {
- throw MessageException(MSG_OPENIN, file, strerror(errno));
+ throw MessageException(LOG_INPUT_OPEN_FAIL, file, strerror(errno));
}
// Loop round reading it. As we process the file one line at a time,
@@ -65,7 +65,7 @@ MessageReader::readFile(const string& file, MessageReader::Mode mode) {
// Why did the loop terminate?
if (!infile.eof()) {
- throw MessageException(MSG_READERR, file, strerror(errno));
+ throw MessageException(LOG_READ_ERROR, file, strerror(errno));
}
infile.close();
}
@@ -114,7 +114,7 @@ MessageReader::parseDirective(const std::string& text) {
} else {
// Unrecognised directive
- throw MessageException(MSG_UNRECDIR, tokens[0], lineno_);
+ throw MessageException(LOG_UNRECOGNISED_DIRECTIVE, tokens[0], lineno_);
}
}
@@ -138,13 +138,13 @@ MessageReader::parsePrefix(const vector<string>& tokens) {
// and numeric characters (and underscores) and does not start with a
// digit.
if (invalidSymbol(prefix_)) {
- throw MessageException(MSG_PRFINVARG, prefix_, lineno_);
+ throw MessageException(LOG_PREFIX_INVALID_ARG, prefix_, lineno_);
}
} else {
// Too many arguments
- throw MessageException(MSG_PRFEXTRARG, lineno_);
+ throw MessageException(LOG_PREFIX_EXTRA_ARGS, lineno_);
}
}
@@ -172,10 +172,10 @@ MessageReader::parseNamespace(const vector<string>& tokens) {
// Check argument count
if (tokens.size() < 2) {
- throw MessageException(MSG_NSNOARG, lineno_);
+ throw MessageException(LOG_NAMESPACE_NO_ARGS, lineno_);
} else if (tokens.size() > 2) {
- throw MessageException(MSG_NSEXTRARG, lineno_);
+ throw MessageException(LOG_NAMESPACE_EXTRA_ARGS, lineno_);
}
@@ -187,12 +187,12 @@ MessageReader::parseNamespace(const vector<string>& tokens) {
"abcdefghijklmnopqrstuvwxyz"
"0123456789_:";
if (tokens[1].find_first_not_of(valid_chars) != string::npos) {
- throw MessageException(MSG_NSINVARG, tokens[1], lineno_);
+ throw MessageException(LOG_NAMESPACE_INVALID_ARG, tokens[1], lineno_);
}
// All OK - unless the namespace has already been set.
if (ns_.size() != 0) {
- throw MessageException(MSG_DUPLNS, lineno_);
+ throw MessageException(LOG_DUPLICATE_NAMESPACE, lineno_);
}
// Prefix has not been set, so set it and return success.
@@ -219,7 +219,7 @@ MessageReader::parseMessage(const std::string& text, MessageReader::Mode mode) {
// A line comprising just the message introducer is not valid.
if (text.size() == 1) {
- throw MessageException(MSG_NOMSGID, text, lineno_);
+ throw MessageException(LOG_NO_MESSAGE_ID, text, lineno_);
}
// Strip off the introducer and any leading space after that.
@@ -230,7 +230,7 @@ MessageReader::parseMessage(const std::string& text, MessageReader::Mode mode) {
if (first_delim == string::npos) {
// Just a single token in the line - this is not valid
- throw MessageException(MSG_NOMSGTXT, message_line, lineno_);
+ throw MessageException(LOG_NO_MESSAGE_TEXT, message_line, lineno_);
}
// Extract the first token into the message ID, preceding it with the
@@ -240,7 +240,7 @@ MessageReader::parseMessage(const std::string& text, MessageReader::Mode mode) {
string ident = prefix_ + message_line.substr(0, first_delim);
if (prefix_.empty()) {
if (invalidSymbol(ident)) {
- throw MessageException(MSG_INVMSGID, ident, lineno_);
+ throw MessageException(LOG_INVALID_MESSAGE_ID, ident, lineno_);
}
}
isc::util::str::uppercase(ident);
@@ -252,7 +252,7 @@ MessageReader::parseMessage(const std::string& text, MessageReader::Mode mode) {
// ?? This happens if there are trailing delimiters, which should not
// occur as we have stripped trailing spaces off the line. Just treat
// this as a single-token error for simplicity's sake.
- throw MessageException(MSG_NOMSGTXT, message_line, lineno_);
+ throw MessageException(LOG_NO_MESSAGE_TEXT, message_line, lineno_);
}
// Add the result to the dictionary and to the non-added list if the add to
diff --git a/src/lib/log/messagedef.cc b/src/lib/log/messagedef.cc
deleted file mode 100644
index 853722a..0000000
--- a/src/lib/log/messagedef.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// File created from messagedef.mes on Fri May 27 14:49:45 2011
-
-#include <cstddef>
-#include <log/message_types.h>
-#include <log/message_initializer.h>
-
-namespace isc {
-namespace log {
-
-extern const isc::log::MessageID MSG_BADDESTINATION = "MSG_BADDESTINATION";
-extern const isc::log::MessageID MSG_BADSEVERITY = "MSG_BADSEVERITY";
-extern const isc::log::MessageID MSG_BADSTREAM = "MSG_BADSTREAM";
-extern const isc::log::MessageID MSG_DUPLNS = "MSG_DUPLNS";
-extern const isc::log::MessageID MSG_DUPMSGID = "MSG_DUPMSGID";
-extern const isc::log::MessageID MSG_IDNOTFND = "MSG_IDNOTFND";
-extern const isc::log::MessageID MSG_INVMSGID = "MSG_INVMSGID";
-extern const isc::log::MessageID MSG_NOMSGID = "MSG_NOMSGID";
-extern const isc::log::MessageID MSG_NOMSGTXT = "MSG_NOMSGTXT";
-extern const isc::log::MessageID MSG_NSEXTRARG = "MSG_NSEXTRARG";
-extern const isc::log::MessageID MSG_NSINVARG = "MSG_NSINVARG";
-extern const isc::log::MessageID MSG_NSNOARG = "MSG_NSNOARG";
-extern const isc::log::MessageID MSG_OPENIN = "MSG_OPENIN";
-extern const isc::log::MessageID MSG_OPENOUT = "MSG_OPENOUT";
-extern const isc::log::MessageID MSG_PRFEXTRARG = "MSG_PRFEXTRARG";
-extern const isc::log::MessageID MSG_PRFINVARG = "MSG_PRFINVARG";
-extern const isc::log::MessageID MSG_RDLOCMES = "MSG_RDLOCMES";
-extern const isc::log::MessageID MSG_READERR = "MSG_READERR";
-extern const isc::log::MessageID MSG_UNRECDIR = "MSG_UNRECDIR";
-extern const isc::log::MessageID MSG_WRITERR = "MSG_WRITERR";
-
-} // namespace log
-} // namespace isc
-
-namespace {
-
-const char* values[] = {
- "MSG_BADDESTINATION", "unrecognized log destination: %1",
- "MSG_BADSEVERITY", "unrecognized log severity: %1",
- "MSG_BADSTREAM", "bad log console output stream: %1",
- "MSG_DUPLNS", "line %1: duplicate $NAMESPACE directive found",
- "MSG_DUPMSGID", "duplicate message ID (%1) in compiled code",
- "MSG_IDNOTFND", "could not replace message text for '%1': no such message",
- "MSG_INVMSGID", "line %1: invalid message identification '%2'",
- "MSG_NOMSGID", "line %1: message definition line found without a message ID",
- "MSG_NOMSGTXT", "line %1: line found containing a message ID ('%2') and no text",
- "MSG_NSEXTRARG", "line %1: $NAMESPACE directive has too many arguments",
- "MSG_NSINVARG", "line %1: $NAMESPACE directive has an invalid argument ('%2')",
- "MSG_NSNOARG", "line %1: no arguments were given to the $NAMESPACE directive",
- "MSG_OPENIN", "unable to open message file %1 for input: %2",
- "MSG_OPENOUT", "unable to open %1 for output: %2",
- "MSG_PRFEXTRARG", "line %1: $PREFIX directive has too many arguments",
- "MSG_PRFINVARG", "line %1: $PREFIX directive has an invalid argument ('%2')",
- "MSG_RDLOCMES", "reading local message file %1",
- "MSG_READERR", "error reading from message file %1: %2",
- "MSG_UNRECDIR", "line %1: unrecognised directive '%2'",
- "MSG_WRITERR", "error writing to %1: %2",
- NULL
-};
-
-const isc::log::MessageInitializer initializer(values);
-
-} // Anonymous namespace
-
diff --git a/src/lib/log/messagedef.h b/src/lib/log/messagedef.h
deleted file mode 100644
index bdb1075..0000000
--- a/src/lib/log/messagedef.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// File created from messagedef.mes on Fri May 27 14:49:45 2011
-
-#ifndef __MESSAGEDEF_H
-#define __MESSAGEDEF_H
-
-#include <log/message_types.h>
-
-namespace isc {
-namespace log {
-
-extern const isc::log::MessageID MSG_BADDESTINATION;
-extern const isc::log::MessageID MSG_BADSEVERITY;
-extern const isc::log::MessageID MSG_BADSTREAM;
-extern const isc::log::MessageID MSG_DUPLNS;
-extern const isc::log::MessageID MSG_DUPMSGID;
-extern const isc::log::MessageID MSG_IDNOTFND;
-extern const isc::log::MessageID MSG_INVMSGID;
-extern const isc::log::MessageID MSG_NOMSGID;
-extern const isc::log::MessageID MSG_NOMSGTXT;
-extern const isc::log::MessageID MSG_NSEXTRARG;
-extern const isc::log::MessageID MSG_NSINVARG;
-extern const isc::log::MessageID MSG_NSNOARG;
-extern const isc::log::MessageID MSG_OPENIN;
-extern const isc::log::MessageID MSG_OPENOUT;
-extern const isc::log::MessageID MSG_PRFEXTRARG;
-extern const isc::log::MessageID MSG_PRFINVARG;
-extern const isc::log::MessageID MSG_RDLOCMES;
-extern const isc::log::MessageID MSG_READERR;
-extern const isc::log::MessageID MSG_UNRECDIR;
-extern const isc::log::MessageID MSG_WRITERR;
-
-} // namespace log
-} // namespace isc
-
-#endif // __MESSAGEDEF_H
diff --git a/src/lib/log/messagedef.mes b/src/lib/log/messagedef.mes
deleted file mode 100644
index a54931b..0000000
--- a/src/lib/log/messagedef.mes
+++ /dev/null
@@ -1,131 +0,0 @@
-# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# \brief Message Utility Message File
-#
-# This is the source of the set of messages generated by the message and
-# logging components. The associated .h and .cc files are created by hand from
-# this file though and are not built during the build process; this is to avoid
-# the chicken-and-egg situation where we need the files to build the message
-# compiler, yet we need the compiler to build the files.
-
-$PREFIX MSG_
-$NAMESPACE isc::log
-
-% DUPMSGID duplicate message ID (%1) in compiled code
-Indicative of a programming error, when it started up, BIND10 detected that
-the given message ID had been registered by one or more modules. (All message
-IDs should be unique throughout BIND10.) This has no impact on the operation
-of the server other that erroneous messages may be logged. (When BIND10 loads
-the message IDs (and their associated text), if a duplicate ID is found it is
-discarded. However, when the module that supplied the duplicate ID logs that
-particular message, the text supplied by the module that added the original
-ID will be output - something that may bear no relation to the condition being
-logged.
-
-% DUPLNS line %1: duplicate $NAMESPACE directive found
-When reading a message file, more than one $NAMESPACE directive was found. In
-this version of the code, such a condition is regarded as an error and the
-read will be abandoned.
-
-% IDNOTFND could not replace message text for '%1': no such message
-During start-up a local message file was read. A line with the listed
-message identification was found in the file, but the identification is not
-one contained in the compiled-in message dictionary. Either the message
-identification has been mis-spelled in the file, or the local file was used
-for an earlier version of the software and the message with that
-identification has been removed.
-
-This message may appear a number of times in the file, once for every such
-unknown message identification.
-
-% INVMSGID line %1: invalid message identification '%2'
-The concatenation of the prefix and the message identification is used as
-a symbol in the C++ module; as such it may only contain
-
-% NOMSGID line %1: message definition line found without a message ID
-Message definition lines are lines starting with a "%". The rest of the line
-should comprise the message ID and text describing the message. This error
-indicates the message compiler found a line in the message file comprising
-just the "%" and nothing else.
-
-% NOMSGTXT line %1: line found containing a message ID ('%2') and no text
-Message definition lines are lines starting with a "%". The rest of the line
-should comprise the message ID and text describing the message. This error
-is generated when a line is found in the message file that contains the
-leading "%" and the message identification but no text.
-
-% NSEXTRARG line %1: $NAMESPACE directive has too many arguments
-The $NAMESPACE directive takes a single argument, a namespace in which all the
-generated symbol names are placed. This error is generated when the
-compiler finds a $NAMESPACE directive with more than one argument.
-
-% NSINVARG line %1: $NAMESPACE directive has an invalid argument ('%2')
-The $NAMESPACE argument should be a valid C++ namespace. The reader does a
-cursory check on its validity, checking that the characters in the namespace
-are correct. The error is generated when the reader finds an invalid
-character. (Valid are alphanumeric characters, underscores and colons.)
-
-% NSNOARG line %1: no arguments were given to the $NAMESPACE directive
-The $NAMESPACE directive takes a single argument, a namespace in which all the
-generated symbol names are placed. This error is generated when the
-compiler finds a $NAMESPACE directive with no arguments.
-
-% OPENIN unable to open message file %1 for input: %2
-The program was not able to open the specified input message file for the
-reason given.
-
-% OPENOUT unable to open %1 for output: %2
-The program was not able to open the specified output file for the reason
-given.
-
-% PRFEXTRARG line %1: $PREFIX directive has too many arguments
-The $PREFIX directive takes a single argument, a prefix to be added to the
-symbol names when a C++ .h file is created. This error is generated when the
-compiler finds a $PREFIX directive with more than one argument.
-
-% PRFINVARG line %1: $PREFIX directive has an invalid argument ('%2')
-The $PREFIX argument is used in a symbol name in a C++ header file. As such,
-it must adhere to restrictions on C++ symbol names (e.g. may only contain
-alphanumeric characters or underscores, and may nor start with a digit).
-A $PREFIX directive was found with an argument (given in the message) that
-violates those restictions.
-
-% RDLOCMES reading local message file %1
-This is an informational message output by BIND10 when it starts to read a
-local message file. (A local message file may replace the text of one of more
-messages; the ID of the message will not be changed though.)
-
-% READERR error reading from message file %1: %2
-The specified error was encountered reading from the named message file.
-
-% WRITERR error writing to %1: %2
-The specified error was encountered by the message compiler when writing to
-the named output file.
-
-% UNRECDIR line %1: unrecognised directive '%2'
-A line starting with a dollar symbol was found, but the first word on the line
-(shown in the message) was not a recognised message compiler directive.
-
-% BADSEVERITY unrecognized log severity: %1
-A logger severity value was given that was not recognized. The severity
-should be one of "DEBUG", "INFO", "WARN", "ERROR", or "FATAL".
-
-% BADDESTINATION unrecognized log destination: %1
-A logger destination value was given that was not recognized. The
-destination should be one of "console", "file", or "syslog".
-
-% BADSTREAM bad log console output stream: %1
-A log console output stream was given that was not recognized. The
-output stream should be one of "stdout", or "stderr"
diff --git a/src/lib/log/output_option.cc b/src/lib/log/output_option.cc
index 191631d..f56efb9 100644
--- a/src/lib/log/output_option.cc
+++ b/src/lib/log/output_option.cc
@@ -13,12 +13,13 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <string>
-#include <log/output_option.h>
-#include <log/macros.h>
-#include <log/messagedef.h>
#include <boost/algorithm/string.hpp>
+#include <log/log_messages.h>
+#include <log/macros.h>
+#include <log/output_option.h>
+
namespace isc {
namespace log {
@@ -32,7 +33,7 @@ getDestination(const std::string& dest_str) {
return OutputOption::DEST_SYSLOG;
} else {
Logger logger("log");
- LOG_ERROR(logger, MSG_BADDESTINATION).arg(dest_str);
+ LOG_ERROR(logger, LOG_BAD_DESTINATION).arg(dest_str);
return OutputOption::DEST_CONSOLE;
}
}
@@ -45,7 +46,7 @@ getStream(const std::string& stream_str) {
return OutputOption::STR_STDOUT;
} else {
Logger logger("log");
- LOG_ERROR(logger, MSG_BADSTREAM).arg(stream_str);
+ LOG_ERROR(logger, LOG_BAD_STREAM).arg(stream_str);
return OutputOption::STR_STDOUT;
}
}
diff --git a/src/lib/log/tests/destination_test.sh.in b/src/lib/log/tests/destination_test.sh.in
index ff2d3fb..43f1425 100755
--- a/src/lib/log/tests/destination_test.sh.in
+++ b/src/lib/log/tests/destination_test.sh.in
@@ -37,10 +37,10 @@ passfail() {
echo "1. One logger, multiple destinations:"
cat > $tempfile << .
-FATAL [example] MSG_WRITERR, error writing to test1: 42
-ERROR [example] MSG_RDLOCMES, reading local message file dummy/file
-FATAL [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta_fatal
-ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_error
+FATAL [example] LOG_WRITE_ERROR, error writing to test1: 42
+ERROR [example] LOG_READING_LOCAL_FILE, reading local message file dummy/file
+FATAL [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta_fatal
+ERROR [example.beta] LOG_BAD_DESTINATION, unrecognized log destination: beta_error
.
rm -f $destfile1 $destfile2
./logger_example -s error -f $destfile1 -f $destfile2
@@ -61,13 +61,13 @@ rm -f $destfile1 $destfile2
# Output for example.alpha should have done to destfile2.
cat > $tempfile << .
-FATAL [example] MSG_WRITERR, error writing to test1: 42
-ERROR [example] MSG_RDLOCMES, reading local message file dummy/file
-WARN [example] MSG_BADSTREAM, bad log console output stream: example
-FATAL [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta_fatal
-ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_error
-WARN [example.beta] MSG_BADSTREAM, bad log console output stream: beta_warn
-INFO [example.beta] MSG_READERR, error reading from message file beta: info
+FATAL [example] LOG_WRITE_ERROR, error writing to test1: 42
+ERROR [example] LOG_READING_LOCAL_FILE, reading local message file dummy/file
+WARN [example] LOG_BAD_STREAM, bad log console output stream: example
+FATAL [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta_fatal
+ERROR [example.beta] LOG_BAD_DESTINATION, unrecognized log destination: beta_error
+WARN [example.beta] LOG_BAD_STREAM, bad log console output stream: beta_warn
+INFO [example.beta] LOG_READ_ERROR, error reading from message file beta: info
.
echo -n " - destination 1:"
cut -d' ' -f3- $destfile1 | diff $tempfile -
@@ -75,7 +75,7 @@ passfail $?
echo -n " - destination 2:"
cat > $tempfile << .
-WARN [example.alpha] MSG_READERR, error reading from message file a.txt: dummy reason
+WARN [example.alpha] LOG_READ_ERROR, error reading from message file a.txt: dummy reason
.
cut -d' ' -f3- $destfile2 | diff $tempfile -
passfail $?
diff --git a/src/lib/log/tests/local_file_test.sh.in b/src/lib/log/tests/local_file_test.sh.in
index 53b0c2f..29f31c3 100755
--- a/src/lib/log/tests/local_file_test.sh.in
+++ b/src/lib/log/tests/local_file_test.sh.in
@@ -37,36 +37,35 @@ passfail() {
# Create the local message file for testing
cat > $localmes << .
-\$PREFIX MSG_
-% NOTHERE this message is not in the global dictionary
-% READERR replacement read error, parameters: '%1' and '%2'
-% RDLOCMES replacement read local message file, parameter is '%1'
+% LOG_NOTHERE this message is not in the global dictionary
+% LOG_READ_ERROR replacement read error, parameters: '%1' and '%2'
+% LOG_READING_LOCAL_FILE replacement read local message file, parameter is '%1'
.
echo -n "1. Local message replacement:"
cat > $tempfile << .
-WARN [example.log] MSG_IDNOTFND, could not replace message text for 'MSG_NOTHERE': no such message
-FATAL [example] MSG_WRITERR, error writing to test1: 42
-ERROR [example] MSG_RDLOCMES, replacement read local message file, parameter is 'dummy/file'
-WARN [example] MSG_BADSTREAM, bad log console output stream: example
-WARN [example.alpha] MSG_READERR, replacement read error, parameters: 'a.txt' and 'dummy reason'
-FATAL [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta_fatal
-ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_error
-WARN [example.beta] MSG_BADSTREAM, bad log console output stream: beta_warn
+WARN [example.log] LOG_NO_SUCH_MESSAGE, could not replace message text for 'LOG_NOTHERE': no such message
+FATAL [example] LOG_WRITE_ERROR, error writing to test1: 42
+ERROR [example] LOG_READING_LOCAL_FILE, replacement read local message file, parameter is 'dummy/file'
+WARN [example] LOG_BAD_STREAM, bad log console output stream: example
+WARN [example.alpha] LOG_READ_ERROR, replacement read error, parameters: 'a.txt' and 'dummy reason'
+FATAL [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta_fatal
+ERROR [example.beta] LOG_BAD_DESTINATION, unrecognized log destination: beta_error
+WARN [example.beta] LOG_BAD_STREAM, bad log console output stream: beta_warn
.
./logger_example -c stdout -s warn $localmes | cut -d' ' -f3- | diff $tempfile -
passfail $?
echo -n "2. Report error if unable to read local message file:"
cat > $tempfile << .
-ERROR [example.log] MSG_OPENIN, unable to open message file $localmes for input: No such file or directory
-FATAL [example] MSG_WRITERR, error writing to test1: 42
-ERROR [example] MSG_RDLOCMES, reading local message file dummy/file
-WARN [example] MSG_BADSTREAM, bad log console output stream: example
-WARN [example.alpha] MSG_READERR, error reading from message file a.txt: dummy reason
-FATAL [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta_fatal
-ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_error
-WARN [example.beta] MSG_BADSTREAM, bad log console output stream: beta_warn
+ERROR [example.log] LOG_INPUT_OPEN_FAIL, unable to open message file $localmes for input: No such file or directory
+FATAL [example] LOG_WRITE_ERROR, error writing to test1: 42
+ERROR [example] LOG_READING_LOCAL_FILE, reading local message file dummy/file
+WARN [example] LOG_BAD_STREAM, bad log console output stream: example
+WARN [example.alpha] LOG_READ_ERROR, error reading from message file a.txt: dummy reason
+FATAL [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta_fatal
+ERROR [example.beta] LOG_BAD_DESTINATION, unrecognized log destination: beta_error
+WARN [example.beta] LOG_BAD_STREAM, bad log console output stream: beta_warn
.
rm -f $localmes
./logger_example -c stdout -s warn $localmes | cut -d' ' -f3- | diff $tempfile -
diff --git a/src/lib/log/tests/logger_example.cc b/src/lib/log/tests/logger_example.cc
index 6b43c18..2170066 100644
--- a/src/lib/log/tests/logger_example.cc
+++ b/src/lib/log/tests/logger_example.cc
@@ -40,7 +40,7 @@
#include <log/macros.h>
// Include a set of message definitions.
-#include <log/messagedef.h>
+#include <log/log_messages.h>
using namespace isc::log;
using namespace std;
@@ -285,21 +285,21 @@ int main(int argc, char** argv) {
isc::log::Logger logger_alpha("alpha");
isc::log::Logger logger_beta("beta");
- LOG_FATAL(logger_ex, MSG_WRITERR).arg("test1").arg("42");
- LOG_ERROR(logger_ex, MSG_RDLOCMES).arg("dummy/file");
- LOG_WARN(logger_ex, MSG_BADSTREAM).arg("example");
- LOG_WARN(logger_alpha, MSG_READERR).arg("a.txt").arg("dummy reason");
- LOG_INFO(logger_alpha, MSG_OPENIN).arg("example.msg").arg("dummy reason");
- LOG_DEBUG(logger_ex, 0, MSG_RDLOCMES).arg("example/0");
- LOG_DEBUG(logger_ex, 24, MSG_RDLOCMES).arg("example/24");
- LOG_DEBUG(logger_ex, 25, MSG_RDLOCMES).arg("example/25");
- LOG_DEBUG(logger_ex, 26, MSG_RDLOCMES).arg("example/26");
- LOG_FATAL(logger_beta, MSG_BADSEVERITY).arg("beta_fatal");
- LOG_ERROR(logger_beta, MSG_BADDESTINATION).arg("beta_error");
- LOG_WARN(logger_beta, MSG_BADSTREAM).arg("beta_warn");
- LOG_INFO(logger_beta, MSG_READERR).arg("beta").arg("info");
- LOG_DEBUG(logger_beta, 25, MSG_BADSEVERITY).arg("beta/25");
- LOG_DEBUG(logger_beta, 26, MSG_BADSEVERITY).arg("beta/26");
+ LOG_FATAL(logger_ex, LOG_WRITE_ERROR).arg("test1").arg("42");
+ LOG_ERROR(logger_ex, LOG_READING_LOCAL_FILE).arg("dummy/file");
+ LOG_WARN(logger_ex, LOG_BAD_STREAM).arg("example");
+ LOG_WARN(logger_alpha, LOG_READ_ERROR).arg("a.txt").arg("dummy reason");
+ LOG_INFO(logger_alpha, LOG_INPUT_OPEN_FAIL).arg("example.msg").arg("dummy reason");
+ LOG_DEBUG(logger_ex, 0, LOG_READING_LOCAL_FILE).arg("example/0");
+ LOG_DEBUG(logger_ex, 24, LOG_READING_LOCAL_FILE).arg("example/24");
+ LOG_DEBUG(logger_ex, 25, LOG_READING_LOCAL_FILE).arg("example/25");
+ LOG_DEBUG(logger_ex, 26, LOG_READING_LOCAL_FILE).arg("example/26");
+ LOG_FATAL(logger_beta, LOG_BAD_SEVERITY).arg("beta_fatal");
+ LOG_ERROR(logger_beta, LOG_BAD_DESTINATION).arg("beta_error");
+ LOG_WARN(logger_beta, LOG_BAD_STREAM).arg("beta_warn");
+ LOG_INFO(logger_beta, LOG_READ_ERROR).arg("beta").arg("info");
+ LOG_DEBUG(logger_beta, 25, LOG_BAD_SEVERITY).arg("beta/25");
+ LOG_DEBUG(logger_beta, 26, LOG_BAD_SEVERITY).arg("beta/26");
return (0);
}
diff --git a/src/lib/log/tests/logger_level_unittest.cc b/src/lib/log/tests/logger_level_unittest.cc
index 13d33b2..8c98091 100644
--- a/src/lib/log/tests/logger_level_unittest.cc
+++ b/src/lib/log/tests/logger_level_unittest.cc
@@ -19,8 +19,8 @@
#include <log/logger.h>
#include <log/logger_manager.h>
+#include <log/log_messages.h>
#include <log/logger_name.h>
-#include <log/messagedef.h>
using namespace isc;
using namespace isc::log;
diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc
index 115c928..0bdfc74 100644
--- a/src/lib/log/tests/logger_manager_unittest.cc
+++ b/src/lib/log/tests/logger_manager_unittest.cc
@@ -27,7 +27,7 @@
#include <exceptions/exceptions.h>
#include <log/macros.h>
-#include <log/messagedef.h>
+#include <log/log_messages.h>
#include <log/logger.h>
#include <log/logger_level.h>
#include <log/logger_manager.h>
@@ -203,16 +203,16 @@ TEST_F(LoggerManagerTest, FileLogger) {
// keep the file open.
Logger logger(file_spec.getLoggerName());
- LOG_FATAL(logger, MSG_DUPMSGID).arg("test");
- ids.push_back(MSG_DUPMSGID);
+ LOG_FATAL(logger, LOG_DUPLICATE_MESSAGE_ID).arg("test");
+ ids.push_back(LOG_DUPLICATE_MESSAGE_ID);
- LOG_FATAL(logger, MSG_DUPLNS).arg("test");
- ids.push_back(MSG_DUPLNS);
+ LOG_FATAL(logger, LOG_DUPLICATE_NAMESPACE).arg("test");
+ ids.push_back(LOG_DUPLICATE_NAMESPACE);
}
LoggerManager::reset();
// At this point, the output file should contain two lines with messages
- // MSG_DUPMSGID and MSG_DUPLNS messages - test this.
+ // LOG_DUPLICATE_MESSAGE_ID and LOG_DUPLICATE_NAMESPACE messages - test this.
checkFileContents(file_spec.getFileName(), ids.begin(), ids.end());
// Re-open the file (we have to assume that it was closed when we
@@ -225,14 +225,14 @@ TEST_F(LoggerManagerTest, FileLogger) {
// Create a new instance of the logger and log three more messages.
Logger logger(file_spec.getLoggerName());
- LOG_FATAL(logger, MSG_IDNOTFND).arg("test");
- ids.push_back(MSG_IDNOTFND);
+ LOG_FATAL(logger, LOG_NO_SUCH_MESSAGE).arg("test");
+ ids.push_back(LOG_NO_SUCH_MESSAGE);
- LOG_FATAL(logger, MSG_INVMSGID).arg("test").arg("test2");
- ids.push_back(MSG_INVMSGID);
+ LOG_FATAL(logger, LOG_INVALID_MESSAGE_ID).arg("test").arg("test2");
+ ids.push_back(LOG_INVALID_MESSAGE_ID);
- LOG_FATAL(logger, MSG_NOMSGID).arg("42");
- ids.push_back(MSG_NOMSGID);
+ LOG_FATAL(logger, LOG_NO_MESSAGE_ID).arg("42");
+ ids.push_back(LOG_NO_MESSAGE_ID);
// Close the file and check again
LoggerManager::reset();
@@ -276,19 +276,19 @@ TEST_F(LoggerManagerTest, FileSizeRollover) {
// be rolled after the message is logged.
{
Logger logger(file_spec.getLoggerName());
- LOG_FATAL(logger, MSG_IDNOTFND).arg(big_arg);
- LOG_FATAL(logger, MSG_DUPLNS).arg(big_arg);
+ LOG_FATAL(logger, LOG_NO_SUCH_MESSAGE).arg(big_arg);
+ LOG_FATAL(logger, LOG_DUPLICATE_NAMESPACE).arg(big_arg);
}
// Check them.
LoggerManager::reset(); // Ensure files are closed
vector<MessageID> ids;
- ids.push_back(MSG_IDNOTFND);
+ ids.push_back(LOG_NO_SUCH_MESSAGE);
checkFileContents(prev_name[1], ids.begin(), ids.end());
ids.clear();
- ids.push_back(MSG_DUPLNS);
+ ids.push_back(LOG_DUPLICATE_NAMESPACE);
checkFileContents(prev_name[0], ids.begin(), ids.end());
// Log another message and check that the files have rotated and that
@@ -296,18 +296,18 @@ TEST_F(LoggerManagerTest, FileSizeRollover) {
manager.process(spec);
{
Logger logger(file_spec.getLoggerName());
- LOG_FATAL(logger, MSG_NOMSGTXT).arg(big_arg);
+ LOG_FATAL(logger, LOG_NO_MESSAGE_TEXT).arg(big_arg);
}
LoggerManager::reset(); // Ensure files are closed
// Check that the files have moved.
ids.clear();
- ids.push_back(MSG_DUPLNS);
+ ids.push_back(LOG_DUPLICATE_NAMESPACE);
checkFileContents(prev_name[1], ids.begin(), ids.end());
ids.clear();
- ids.push_back(MSG_NOMSGTXT);
+ ids.push_back(LOG_NO_MESSAGE_TEXT);
checkFileContents(prev_name[0], ids.begin(), ids.end());
// ... and check that the .3 version does not exist.
diff --git a/src/lib/log/tests/logger_unittest.cc b/src/lib/log/tests/logger_unittest.cc
index b7858e5..edca9ce 100644
--- a/src/lib/log/tests/logger_unittest.cc
+++ b/src/lib/log/tests/logger_unittest.cc
@@ -20,7 +20,7 @@
#include <log/logger.h>
#include <log/logger_manager.h>
#include <log/logger_name.h>
-#include <log/messagedef.h>
+#include <log/log_messages.h>
using namespace isc;
using namespace isc::log;
diff --git a/src/lib/log/tests/message_dictionary_unittest.cc b/src/lib/log/tests/message_dictionary_unittest.cc
index ba33820..394fea0 100644
--- a/src/lib/log/tests/message_dictionary_unittest.cc
+++ b/src/lib/log/tests/message_dictionary_unittest.cc
@@ -29,7 +29,7 @@ using namespace std;
// and the latter should be present.
static const char* values[] = {
- "MSG_DUPLNS", "duplicate $NAMESPACE directive found",
+ "LOG_DUPLICATE_NAMESPACE", "duplicate $NAMESPACE directive found",
"NEWSYM", "new symbol added",
NULL
};
@@ -190,7 +190,7 @@ TEST_F(MessageDictionaryTest, GlobalTest) {
TEST_F(MessageDictionaryTest, GlobalLoadTest) {
vector<string>& duplicates = MessageInitializer::getDuplicates();
ASSERT_EQ(1, duplicates.size());
- EXPECT_EQ(string("MSG_DUPLNS"), duplicates[0]);
+ EXPECT_EQ(string("LOG_DUPLICATE_NAMESPACE"), duplicates[0]);
string text = MessageDictionary::globalDictionary().getText("NEWSYM");
EXPECT_EQ(string("new symbol added"), text);
diff --git a/src/lib/log/tests/message_reader_unittest.cc b/src/lib/log/tests/message_reader_unittest.cc
index 7b3ba5f..d0214a4 100644
--- a/src/lib/log/tests/message_reader_unittest.cc
+++ b/src/lib/log/tests/message_reader_unittest.cc
@@ -16,7 +16,7 @@
#include <string>
#include <gtest/gtest.h>
-#include <log/messagedef.h>
+#include <log/log_messages.h>
#include <log/message_dictionary.h>
#include <log/message_exception.h>
#include <log/message_reader.h>
@@ -102,8 +102,8 @@ processLineException(MessageReader& reader, const char* what,
TEST_F(MessageReaderTest, InvalidDirectives) {
// Check that a "$" with nothing else generates an error
- processLineException(reader_, "$", MSG_UNRECDIR);
- processLineException(reader_, "$xyz", MSG_UNRECDIR);
+ processLineException(reader_, "$", LOG_UNRECOGNISED_DIRECTIVE);
+ processLineException(reader_, "$xyz", LOG_UNRECOGNISED_DIRECTIVE);
}
// Check that it can parse a prefix
@@ -117,20 +117,20 @@ TEST_F(MessageReaderTest, Prefix) {
EXPECT_NO_THROW(reader_.processLine("$PREFIX"));
// Check a $PREFIX with multiple arguments is invalid
- processLineException(reader_, "$prefix A B", MSG_PRFEXTRARG);
+ processLineException(reader_, "$prefix A B", LOG_PREFIX_EXTRA_ARGS);
// Prefixes should be alphanumeric (with underscores) and not start
// with a number.
- processLineException(reader_, "$prefix ab[cd", MSG_PRFINVARG);
- processLineException(reader_, "$prefix 123", MSG_PRFINVARG);
- processLineException(reader_, "$prefix 1ABC", MSG_PRFINVARG);
+ processLineException(reader_, "$prefix ab[cd", LOG_PREFIX_INVALID_ARG);
+ processLineException(reader_, "$prefix 123", LOG_PREFIX_INVALID_ARG);
+ processLineException(reader_, "$prefix 1ABC", LOG_PREFIX_INVALID_ARG);
// A valid prefix should be accepted
EXPECT_NO_THROW(reader_.processLine("$PREFIX dlm__"));
EXPECT_EQ(string("dlm__"), reader_.getPrefix());
// And check that the parser fails on invalid prefixes...
- processLineException(reader_, "$prefix 1ABC", MSG_PRFINVARG);
+ processLineException(reader_, "$prefix 1ABC", LOG_PREFIX_INVALID_ARG);
// Check that we can clear the prefix as well
reader_.clearPrefix();
@@ -150,13 +150,13 @@ TEST_F(MessageReaderTest, Namespace) {
EXPECT_EQ(string(""), reader_.getNamespace());
// Check that a $NAMESPACE directive with no argument generates an error.
- processLineException(reader_, "$NAMESPACE", MSG_NSNOARG);
+ processLineException(reader_, "$NAMESPACE", LOG_NAMESPACE_NO_ARGS);
// Check a $NAMESPACE with multiple arguments is invalid
- processLineException(reader_, "$namespace A B", MSG_NSEXTRARG);
+ processLineException(reader_, "$namespace A B", LOG_NAMESPACE_EXTRA_ARGS);
// Namespaces should be alphanumeric (with underscores and colons)
- processLineException(reader_, "$namespace ab[cd", MSG_NSINVARG);
+ processLineException(reader_, "$namespace ab[cd", LOG_NAMESPACE_INVALID_ARG);
// A valid $NAMESPACE should be accepted
EXPECT_NO_THROW(reader_.processLine("$NAMESPACE isc"));
@@ -176,7 +176,7 @@ TEST_F(MessageReaderTest, Namespace) {
EXPECT_EQ(string("::"), reader_.getNamespace());
// ... and that another $NAMESPACE is rejected
- processLineException(reader_, "$NAMESPACE ABC", MSG_DUPLNS);
+ processLineException(reader_, "$NAMESPACE ABC", LOG_DUPLICATE_NAMESPACE);
}
// Check that it can parse a line
diff --git a/src/lib/log/tests/severity_test.sh.in b/src/lib/log/tests/severity_test.sh.in
index 6f4d27a..15d78d4 100755
--- a/src/lib/log/tests/severity_test.sh.in
+++ b/src/lib/log/tests/severity_test.sh.in
@@ -35,44 +35,44 @@ passfail() {
echo -n "1. runInitTest default parameters:"
cat > $tempfile << .
-FATAL [example] MSG_WRITERR, error writing to test1: 42
-ERROR [example] MSG_RDLOCMES, reading local message file dummy/file
-WARN [example] MSG_BADSTREAM, bad log console output stream: example
-WARN [example.alpha] MSG_READERR, error reading from message file a.txt: dummy reason
-INFO [example.alpha] MSG_OPENIN, unable to open message file example.msg for input: dummy reason
-FATAL [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta_fatal
-ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_error
-WARN [example.beta] MSG_BADSTREAM, bad log console output stream: beta_warn
-INFO [example.beta] MSG_READERR, error reading from message file beta: info
+FATAL [example] LOG_WRITE_ERROR, error writing to test1: 42
+ERROR [example] LOG_READING_LOCAL_FILE, reading local message file dummy/file
+WARN [example] LOG_BAD_STREAM, bad log console output stream: example
+WARN [example.alpha] LOG_READ_ERROR, error reading from message file a.txt: dummy reason
+INFO [example.alpha] LOG_INPUT_OPEN_FAIL, unable to open message file example.msg for input: dummy reason
+FATAL [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta_fatal
+ERROR [example.beta] LOG_BAD_DESTINATION, unrecognized log destination: beta_error
+WARN [example.beta] LOG_BAD_STREAM, bad log console output stream: beta_warn
+INFO [example.beta] LOG_READ_ERROR, error reading from message file beta: info
.
./logger_example -c stdout | cut -d' ' -f3- | diff $tempfile -
passfail $?
echo -n "2. Severity filter:"
cat > $tempfile << .
-FATAL [example] MSG_WRITERR, error writing to test1: 42
-ERROR [example] MSG_RDLOCMES, reading local message file dummy/file
-FATAL [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta_fatal
-ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_error
+FATAL [example] LOG_WRITE_ERROR, error writing to test1: 42
+ERROR [example] LOG_READING_LOCAL_FILE, reading local message file dummy/file
+FATAL [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta_fatal
+ERROR [example.beta] LOG_BAD_DESTINATION, unrecognized log destination: beta_error
.
./logger_example -c stdout -s error | cut -d' ' -f3- | diff $tempfile -
passfail $?
echo -n "3. Debug level:"
cat > $tempfile << .
-FATAL [example] MSG_WRITERR, error writing to test1: 42
-ERROR [example] MSG_RDLOCMES, reading local message file dummy/file
-WARN [example] MSG_BADSTREAM, bad log console output stream: example
-WARN [example.alpha] MSG_READERR, error reading from message file a.txt: dummy reason
-INFO [example.alpha] MSG_OPENIN, unable to open message file example.msg for input: dummy reason
-DEBUG [example] MSG_RDLOCMES, reading local message file example/0
-DEBUG [example] MSG_RDLOCMES, reading local message file example/24
-DEBUG [example] MSG_RDLOCMES, reading local message file example/25
-FATAL [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta_fatal
-ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_error
-WARN [example.beta] MSG_BADSTREAM, bad log console output stream: beta_warn
-INFO [example.beta] MSG_READERR, error reading from message file beta: info
-DEBUG [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta/25
+FATAL [example] LOG_WRITE_ERROR, error writing to test1: 42
+ERROR [example] LOG_READING_LOCAL_FILE, reading local message file dummy/file
+WARN [example] LOG_BAD_STREAM, bad log console output stream: example
+WARN [example.alpha] LOG_READ_ERROR, error reading from message file a.txt: dummy reason
+INFO [example.alpha] LOG_INPUT_OPEN_FAIL, unable to open message file example.msg for input: dummy reason
+DEBUG [example] LOG_READING_LOCAL_FILE, reading local message file example/0
+DEBUG [example] LOG_READING_LOCAL_FILE, reading local message file example/24
+DEBUG [example] LOG_READING_LOCAL_FILE, reading local message file example/25
+FATAL [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta_fatal
+ERROR [example.beta] LOG_BAD_DESTINATION, unrecognized log destination: beta_error
+WARN [example.beta] LOG_BAD_STREAM, bad log console output stream: beta_warn
+INFO [example.beta] LOG_READ_ERROR, error reading from message file beta: info
+DEBUG [example.beta] LOG_BAD_SEVERITY, unrecognized log severity: beta/25
.
./logger_example -c stdout -s debug -d 25 | cut -d' ' -f3- | diff $tempfile -
passfail $?
More information about the bind10-changes
mailing list